So, here we are! After a restart of my machine everything works fine now,

Christian
Index: win32object.inc
===================================================================
--- win32object.inc     (revision 9708)
+++ win32object.inc     (working copy)
@@ -224,8 +224,16 @@
   Brings the entire application on top of all other non-topmost programs
  
------------------------------------------------------------------------------}
 procedure TWin32WidgetSet.AppBringToFront;
+var
+  TopWindow: HWnd;
 begin
-  Windows.SetForegroundWindow(FAppHandle);
+  if FAppHandle <> 0 then
+  begin
+    TopWindow := GetLastActivePopup(FAppHandle);
+    if (TopWindow <> 0) and (TopWindow <> FAppHandle) and
+      IsWindowVisible(TopWindow) and IsWindowEnabled(TopWindow) then
+      Windows.SetForegroundWindow(TopWindow);
+  end;
 end;
 
 procedure TWin32WidgetSet.SetDesigning(AComponent: TComponent);
Index: win32callback.inc
===================================================================
--- win32callback.inc   (revision 9708)
+++ win32callback.inc   (working copy)
@@ -657,26 +657,37 @@
     lControl: TControl;
     BoundsOffset: TRect;
   begin
-    if (lWinControl <> nil) and not (csDesigning in lWinControl.ComponentState)
-      and (Lo(LParam) = HTCLIENT) then
-    begin
-      Windows.GetCursorPos(Windows.POINT(P));
-      Windows.ScreenToClient(Window, Windows.POINT(P));
-      if GetLCLClientBoundsOffset(lWinControl.Parent, BoundsOffset) then
-      begin
-        Dec(P.X, BoundsOffset.Left);
-        Dec(P.Y, BoundsOffset.Top);
+    if (lWinControl <> nil) and not (csDesigning in 
lWinControl.ComponentState) then
+      case Lo(LParam) of
+        HTCLIENT:
+          begin
+            Windows.GetCursorPos(Windows.POINT(P));
+            Windows.ScreenToClient(Window, Windows.POINT(P));
+            if GetLCLClientBoundsOffset(lWinControl.Parent, BoundsOffset) then
+            begin
+              Dec(P.X, BoundsOffset.Left);
+              Dec(P.Y, BoundsOffset.Top);
+            end;
+            // statictext controls do not get WM_SETCURSOR messages...
+            lControl := lWinControl.ControlAtPos(P, false, true);
+            if lControl = nil then
+              lControl := lWinControl;
+            if lControl.Cursor <> crDefault then
+            begin
+              Windows.SetCursor(Windows.LoadCursor(0, 
LclCursorToWin32CursorMap[lControl.Cursor]));
+              LMessage.Result := 1;
+            end;
+          end;
+        HTERROR:
+          begin
+            if (Hi(LParam) = WM_LBUTTONDOWN) and 
(TWin32WidgetSet(WidgetSet).AppHandle <> 0) and
+              (GetForegroundWindow <> 
GetLastActivePopup(TWin32WidgetSet(WidgetSet).AppHandle)) then
+            begin
+              Application.BringToFront;
+              Exit;
+            end;
+          end;
       end;
-      // statictext controls do not get WM_SETCURSOR messages...
-      lControl := lWinControl.ControlAtPos(P, false, true);
-      if lControl = nil then
-        lControl := lWinControl;
-      if lControl.Cursor <> crDefault then
-      begin
-        Windows.SetCursor(Windows.LoadCursor(0, 
LclCursorToWin32CursorMap[lControl.Cursor]));
-        LMessage.Result := 1;
-      end;
-    end;
     if LMessage.Result = 0 then
     begin
       LMessage.Msg := LM_SETCURSOR;

Reply via email to