Win32: when app is minimized together with modal window(s), do not restore non modal form, but complete app.Related to issues #26463 and #29744

git-svn-id: trunk@51729 -
This commit is contained in:
zeljko 2016-02-27 11:08:30 +00:00
parent 834fb90d08
commit 5dfc7d3727

View File

@ -1861,6 +1861,7 @@ var
// used by WM_CHAR, WM_SYSCHAR and WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP
CharCodeNotEmpty: boolean;
R: TRect;
ACtl: TWinControl;
begin
FillChar(LMessage, SizeOf(LMessage), 0);
PLMsg := @LMessage;
@ -2168,8 +2169,18 @@ begin
if not IsIconic(Window) and (GetFocus = Window) then
begin
TargetWindow := LookupTopWindow(Window);
if TargetWindow <> Window then
begin
// issues #26463, #29744
if (Application.ModalLevel > 0) and IsIconic(TargetWindow) then
begin
ACtl := FindControl(TargetWindow);
if (ACtl is TCustomForm) and (fsModal in TCustomForm(ACtl).FormState) then
Win32WidgetSet.AppRestore;
end;
SetFocus(TargetWindow);
end;
end;
Result := 0;
Exit;