win32: save/restore child windows state on minimze/restore (issue #0024055)

git-svn-id: trunk@42127 -
This commit is contained in:
paul 2013-07-18 07:12:33 +00:00
parent 987e73434f
commit 0a3953816b
2 changed files with 27 additions and 0 deletions

View File

@ -48,6 +48,7 @@ Type
List: TStrings;
StayOnTopList: TFPList; // a list of windows that were normalized when showing modal
MaxLength: integer;
RestoreState: LongInt; // restore window state
MouseX, MouseY: smallint; // noticing spurious WM_MOUSEMOVE messages
DispInfoTextA: array [0..LV_DISP_INFO_COUNT-1] of AnsiString; // buffer for ListView LVN_GETDISPINFO notification
DispInfoTextW: array [0..LV_DISP_INFO_COUNT-1] of WideString; // it's recommended to keep buffer unchanged

View File

@ -365,6 +365,32 @@ begin
SetMinMaxInfo(WinControl, PMINMAXINFO(LParam)^);
Exit(CallDefaultWindowProc(Window, Msg, WParam, LParam));
end;
WM_SHOWWINDOW:
begin
// this happens when parent window is being minized/restored
// an example of parent window can be an Application.Handle window if MainFormOnTaskBar = False
case LParam of
SW_PARENTCLOSING:
begin
if IsIconic(Window) then
Info^.RestoreState := SW_SHOWMINNOACTIVE
else
if IsZoomed(Window) then
Info^.RestoreState := SW_SHOWMAXIMIZED
else
Info^.RestoreState := SW_SHOWNOACTIVATE;
end;
SW_PARENTOPENING:
begin
if Info^.RestoreState <> 0 then
begin
Windows.ShowWindow(Window, Info^.RestoreState);
Info^.RestoreState := 0;
Exit(CallDefaultWindowProc(Window, Msg, WParam, LParam));
end;
end;
end;
end;
end;
Result := WindowProc(Window, Msg, WParam, LParam);
end;