LCL-Win32: Do not change window Z-order when minimizing and then restoring IDE with opened form designers. Patch by Red_prig (Pavel), issue #40576.

This commit is contained in:
Maxim Ganetsky 2023-10-30 02:12:25 +03:00
parent ffee752335
commit b64bba34d7
3 changed files with 15 additions and 6 deletions

View File

@ -1019,9 +1019,12 @@ begin
begin
Windows.SetWindowPos(Window, HWND_TOP,
Application.MainForm.Left, Application.MainForm.Top,
Application.MainForm.Width, 0, SWP_NOACTIVATE);
Application.MainForm.Width, 0, SWP_NOACTIVATE or SWP_NOZORDER);
if Application.MainForm.HandleAllocated then
Windows.ShowWindow(Application.MainFormHandle, SW_HIDE);
Windows.SetWindowPos(Application.MainFormHandle, HWND_TOP,
0,0,0,0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_HIDEWINDOW);
end;
PLMsg^.Result := Windows.DefWindowProc(Window, WM_SYSCOMMAND, WParam, LParam);
WinProcess := False;
@ -1052,7 +1055,9 @@ begin
if Assigned(Application.MainForm) and Application.MainForm.HandleAllocated then
begin
if Application.MainForm.HandleObjectShouldBeVisible then
Windows.ShowWindow(Application.MainFormHandle, SW_SHOWNA);
Windows.SetWindowPos(Application.MainFormHandle, HWND_TOP,
0,0,0,0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_NOZORDER or SWP_SHOWWINDOW);
RestorePopups;
end;
Application.IntfAppRestore;

View File

@ -956,7 +956,9 @@ begin
EnumThreadWindows(GetWindowThreadProcessId(Application.MainFormHandle, nil),
@EnumHidePopups, LPARAM(Info));
for i := 0 to PopupOwnersList.Count - 1 do
ShowOwnedPopups(HWND(PopupOwnersList[i]), False);
Windows.SetWindowPos(HWND(PopupOwnersList[i]), HWND_TOP,
0,0,0,0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_HIDEWINDOW);
finally
Dispose(Info);
end;
@ -970,7 +972,9 @@ begin
if Assigned(PopupOwnersList) then
begin
for i := 0 to PopupOwnersList.Count - 1 do
ShowOwnedPopups(HWND(PopupOwnersList[i]), True);
Windows.SetWindowPos(HWND(PopupOwnersList[i]), HWND_TOP,
0,0,0,0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_NOZORDER or SWP_SHOWWINDOW);
FreeAndNil(PopupOwnersList);
end;
end;

View File

@ -399,7 +399,7 @@ begin
end;
SW_PARENTOPENING:
begin
if (Info^.RestoreState <> 0) and WinControl.Visible then
if (Info^.RestoreState <> 0) and WinControl.IsControlVisible then
begin
Windows.ShowWindowAsync(Window, Info^.RestoreState);
Info^.RestoreState := 0;