mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 09:30:37 +02:00
win32: hide/restore popup windows on application.minimize/restore (issue #0016577)
git-svn-id: trunk@29955 -
This commit is contained in:
parent
9487b41cc5
commit
5445a84dc4
@ -803,6 +803,7 @@ var
|
|||||||
|
|
||||||
if (Window = Win32WidgetSet.AppHandle) and not Application.MainFormOnTaskBar then
|
if (Window = Win32WidgetSet.AppHandle) and not Application.MainFormOnTaskBar then
|
||||||
begin
|
begin
|
||||||
|
HidePopups(Win32WidgetSet.AppHandle);
|
||||||
if Assigned(Application.MainForm) then
|
if Assigned(Application.MainForm) then
|
||||||
begin
|
begin
|
||||||
Windows.SetWindowPos(Window, HWND_TOP,
|
Windows.SetWindowPos(Window, HWND_TOP,
|
||||||
@ -838,6 +839,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if Application.MainForm.HandleObjectShouldBeVisible then
|
if Application.MainForm.HandleObjectShouldBeVisible then
|
||||||
Windows.ShowWindow(Application.MainFormHandle, SW_SHOWNA);
|
Windows.ShowWindow(Application.MainFormHandle, SW_SHOWNA);
|
||||||
|
RestorePopups;
|
||||||
end;
|
end;
|
||||||
Application.IntfAppRestore;
|
Application.IntfAppRestore;
|
||||||
end
|
end
|
||||||
|
@ -104,6 +104,8 @@ function GetWin32WindowInfo(Window: HWND): PWin32WindowInfo;
|
|||||||
|
|
||||||
procedure RemoveStayOnTopFlags(Window: HWND; ASystemTopAlso: Boolean = False);
|
procedure RemoveStayOnTopFlags(Window: HWND; ASystemTopAlso: Boolean = False);
|
||||||
procedure RestoreStayOnTopFlags(Window: HWND);
|
procedure RestoreStayOnTopFlags(Window: HWND);
|
||||||
|
procedure HidePopups(AppHandle: HWND);
|
||||||
|
procedure RestorePopups;
|
||||||
|
|
||||||
procedure AddToChangedMenus(Window: HWnd);
|
procedure AddToChangedMenus(Window: HWnd);
|
||||||
procedure RedrawMenus;
|
procedure RedrawMenus;
|
||||||
@ -136,6 +138,12 @@ type
|
|||||||
SystemTopAlso: Boolean;
|
SystemTopAlso: Boolean;
|
||||||
StayOnTopList: TList;
|
StayOnTopList: TList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
PPopupOwnersWindowInfo = ^TPopupOwnersWindowInfo;
|
||||||
|
TPopupOwnersWindowInfo = record
|
||||||
|
AppHandle: HWND;
|
||||||
|
OwnersList: TList;
|
||||||
|
end;
|
||||||
|
|
||||||
TWindowsVersion = (
|
TWindowsVersion = (
|
||||||
wvUnknown,
|
wvUnknown,
|
||||||
@ -176,6 +184,7 @@ uses
|
|||||||
|
|
||||||
var
|
var
|
||||||
InRemoveStayOnTopFlags: Integer = 0;
|
InRemoveStayOnTopFlags: Integer = 0;
|
||||||
|
PopupOwnersList: TList = nil;
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function: WM_To_String
|
function: WM_To_String
|
||||||
Params: WM_Message - a WinDows message
|
Params: WM_Message - a WinDows message
|
||||||
@ -1021,6 +1030,49 @@ begin
|
|||||||
// WriteLn('RestoreStayOnTopFlags 2');
|
// WriteLn('RestoreStayOnTopFlags 2');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function EnumHidePopups(Handle: HWND; Param: LPARAM): WINBOOL; stdcall;
|
||||||
|
var
|
||||||
|
Owner: HWND;
|
||||||
|
begin
|
||||||
|
Owner := GetWindow(Handle, GW_OWNER);
|
||||||
|
if (Owner <> 0) and (Owner <> PPopupOwnersWindowInfo(Param)^.AppHandle) then
|
||||||
|
PPopupOwnersWindowInfo(Param)^.OwnersList.Add(Pointer(Owner));
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure HidePopups(AppHandle: HWND);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Info: PPopupOwnersWindowInfo;
|
||||||
|
begin
|
||||||
|
if not Assigned(PopupOwnersList) then
|
||||||
|
begin
|
||||||
|
PopupOwnersList := TList.Create;
|
||||||
|
New(Info);
|
||||||
|
try
|
||||||
|
Info^.AppHandle := AppHandle;
|
||||||
|
Info^.OwnersList := PopupOwnersList;
|
||||||
|
EnumThreadWindows(GetWindowThreadProcessId(Application.MainFormHandle, nil),
|
||||||
|
@EnumHidePopups, LPARAM(Info));
|
||||||
|
for i := 0 to PopupOwnersList.Count - 1 do
|
||||||
|
ShowOwnedPopups(HWND(PopupOwnersList[i]), False);
|
||||||
|
finally
|
||||||
|
Dispose(Info);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RestorePopups;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if Assigned(PopupOwnersList) then
|
||||||
|
begin
|
||||||
|
for i := 0 to PopupOwnersList.Count - 1 do
|
||||||
|
ShowOwnedPopups(HWND(PopupOwnersList[i]), True);
|
||||||
|
FreeAndNil(PopupOwnersList);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
procedure AddToChangedMenus(Window: HWnd);
|
procedure AddToChangedMenus(Window: HWnd);
|
||||||
@ -1713,5 +1765,6 @@ finalization
|
|||||||
Windows.GlobalDeleteAtom(WindowInfoAtom);
|
Windows.GlobalDeleteAtom(WindowInfoAtom);
|
||||||
WindowInfoAtom := 0;
|
WindowInfoAtom := 0;
|
||||||
ChangedMenus.Free;
|
ChangedMenus.Free;
|
||||||
|
FreeAndNil(PopupOwnersList);
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user