Qt: do not restore lcl app if we are minimized & restored via pager actions (switching virtual desktops).

git-svn-id: trunk@31298 -
This commit is contained in:
zeljko 2011-06-20 14:17:19 +00:00
parent 2c28620def
commit e6ada195c2
3 changed files with 15 additions and 1 deletions

View File

@ -173,6 +173,7 @@ type
public
{$IFDEF HASX11}
FLastMinimizeEvent: DWord; // track mainform minimize events -> TQtMainWindow.EventFilter
FMinimizedByPager: Boolean; // track if app is minimized via desktop pager or by us.
{$ENDIF}
function CreateDefaultFont: HFONT; virtual;
function GetDefaultAppFontName: WideString;

View File

@ -96,6 +96,7 @@ begin
StayOnTopList := nil;
FEatNextDeactivate := False;
{$IFDEF HASX11}
FMinimizedByPager := False;
FLastMinimizeEvent := 0;
if ((QtVersionMajor = 4) and (QtVersionMinor < 6)) or IsOldKDEInstallation then
QtX11InitializePalettes;

View File

@ -5063,7 +5063,10 @@ begin
AState := getWindowState;
IsMinimizeEvent := AState and QtWindowMinimized <> 0;
if IsMinimizeEvent then
begin
CanSendEvent := IsCurrentDesktop(Widget);
QtWidgetSet.FMinimizedByPager := not CanSendEvent;
end;
{$ENDIF}
if IsMainForm and CanSendEvent then
begin
@ -5078,7 +5081,16 @@ begin
if (AOldState and QtWindowMinimized <> 0) or
(AOldState and QtWindowMaximized <> 0) or
(AOldState and QtWindowFullScreen <> 0) then
Application.IntfAppRestore;
begin
{$IFDEF HASX11}
// do not activate lazarus app if it wasn't active during
// pager switch !
if (AOldState and QtWindowMinimized <> 0) and QtWidgetSet.FMinimizedByPager then
QtWidgetSet.FMinimizedByPager := False
else
{$ENDIF}
Application.IntfAppRestore;
end;
end;
if CanSendEvent then
SlotWindowStateChange;