On 10/28/2015 01:06 PM, Gabor Boros wrote:
2015.10.28. 11:51 keltezéssel, Zeljko írta:
Ok, then go to QtWSForms, TQtWSCustomForms.UpdateWindowFlags and comment
if csNoStdEvents ..... leave only
Flags := Flags or QtX11BypassWindowManagerHint;

in this case form will not take focus in any case, but must see what
happens with parenting (button is not visible because of this param I
guess).

Commented out "if csNoStdEvents..." line. Button not visible on form
with out without csNoStdEvents in ControlStyle.

Please check with attached patch (same name as previous one). Seem that our C bindings does not have all attributes translated since they did not exist in Qt-4.5, but sometime later. I've added strict X11 attribute and now it does not steal activation or focus, even if clicked with mouse (tested with your example with button).

zeljko

Index: lcl/interfaces/qt/qtwsforms.pp
===================================================================
--- lcl/interfaces/qt/qtwsforms.pp	(revision 50180)
+++ lcl/interfaces/qt/qtwsforms.pp	(working copy)
@@ -923,6 +923,20 @@
 
   if not (csDesigning in AWidget.LCLObject.ComponentState) then
   begin
+    if (csNoFocus in TCustomForm(AWidget.LCLObject).ControlStyle) then
+    begin
+      {$IFDEF HASX11}
+      if ((QtVersionMajor = 4) and (QtVersionMinor >= 7)) or
+        (QtVersionMajor > 4) then
+      begin
+        if QtVersionMajor = 4 then
+          AWidget.setAttribute(132 {QtWA_X11DoNotAcceptFocus}, True)
+        else // Qt 5
+          AWidget.setAttribute(126 {QtWA_X11DoNotAcceptFocus}, True)
+      end;
+      {$ENDIF}
+      AWidget.setAttribute(QtWA_ShowWithoutActivating, True);
+    end;
     AWidget.setWindowFlags(Flags);
     if ABorderStyle in [bsDialog, bsNone, bsSingle] then
       AWidget.Resize(AWidget.LCLObject.Width, AWidget.LCLObject.Height)
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to