diff --git a/lcl/interfaces/qt5/qtwinapi.inc b/lcl/interfaces/qt5/qtwinapi.inc index 689d0bb98e..48bdb245c4 100644 --- a/lcl/interfaces/qt5/qtwinapi.inc +++ b/lcl/interfaces/qt5/qtwinapi.inc @@ -2010,7 +2010,6 @@ begin Result := SIMPLEREGION else Result := COMPLEXREGION; - finally QRegion_destroy(ClipRegion); QRegion_destroy(Region); @@ -5996,7 +5995,7 @@ begin {$note this should return current system active window, not application one, if our app isn''t active. This is per MSDN and pretty win32 specific} - if WindowManagerName = 'metacity' then + if not IsWayland and (WindowManagerName = 'metacity') then Result := HwndFromWidgetH(X11GetActivewindow) else Result := GetActiveWindow; @@ -6011,7 +6010,9 @@ begin if HWND <> 0 then begin Result := TQtWidget(HWND).IsActiveWindow; - TQtWidget(HWnd).Activate; + if (TQtWidget(Hwnd).getWindowState and QtWindowMinimized) = QtWindowMinimized then + TQtWidget(Hwnd).ShowNormal; + TQtWidget(HWnd).BringToFront; end; end; diff --git a/lcl/interfaces/qt6/qtwinapi.inc b/lcl/interfaces/qt6/qtwinapi.inc index f4b53dc8ea..aa2f8ca1d9 100644 --- a/lcl/interfaces/qt6/qtwinapi.inc +++ b/lcl/interfaces/qt6/qtwinapi.inc @@ -2007,7 +2007,6 @@ begin Result := SIMPLEREGION else Result := COMPLEXREGION; - finally QRegion_destroy(ClipRegion); QRegion_destroy(Region); @@ -6038,7 +6037,7 @@ begin {$note this should return current system active window, not application one, if our app isn''t active. This is per MSDN and pretty win32 specific} - if WindowManagerName = 'metacity' then + if not IsWayland and (WindowManagerName = 'metacity') then Result := HwndFromWidgetH(X11GetActivewindow) else Result := GetActiveWindow; @@ -6053,7 +6052,9 @@ begin if HWND <> 0 then begin Result := TQtWidget(HWND).IsActiveWindow; - TQtWidget(HWnd).Activate; + if (TQtWidget(Hwnd).getWindowState and QtWindowMinimized) = QtWindowMinimized then + TQtWidget(Hwnd).ShowNormal; + TQtWidget(HWnd).BringToFront; end; end;