mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 09:19:14 +02:00
win32: Fixed appminimize from modal forms. Minimizing modal form now minimizes complete application. issue #26463
git-svn-id: trunk@51711 -
This commit is contained in:
parent
f02782c7e0
commit
84f6747f70
@ -933,7 +933,6 @@ begin
|
||||
if Application.MainForm.HandleAllocated then
|
||||
Windows.ShowWindow(Application.MainFormHandle, SW_HIDE);
|
||||
end;
|
||||
|
||||
PLMsg^.Result := Windows.DefWindowProc(Window, WM_SYSCOMMAND, WParam, LParam);
|
||||
WinProcess := False;
|
||||
Application.IntfAppMinimize;
|
||||
@ -944,6 +943,12 @@ begin
|
||||
PLMsg^.Result := Windows.DefWindowProc(Window, WM_SYSCOMMAND, WParam, LParam);
|
||||
WinProcess := False;
|
||||
Application.IntfAppMinimize;
|
||||
end else
|
||||
if Assigned(lWinControl) and (fsModal in TCustomForm(lWinControl).FormState) then
|
||||
begin
|
||||
// issue #26463
|
||||
PLMsg^.Result := 1;
|
||||
Win32WidgetSet.AppMinimize;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -962,7 +967,15 @@ begin
|
||||
Application.IntfAppRestore;
|
||||
end
|
||||
else if Assigned(lWinControl) and (lWinControl = Application.MainForm) then
|
||||
begin
|
||||
Application.IntfAppRestore;
|
||||
end else
|
||||
if Assigned(lWinControl) and (fsModal in TCustomForm(lWinControl).FormState) then
|
||||
begin
|
||||
// issue #26463
|
||||
PLMsg^.Result := 1;
|
||||
Win32WidgetSet.AppRestore;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWindowProcHelper.HandleSysCommand;
|
||||
|
@ -164,11 +164,25 @@ end;
|
||||
Minimizes the whole application to the taskbar
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWin32WidgetSet.AppMinimize;
|
||||
var
|
||||
AForm: TCustomForm;
|
||||
i: Integer;
|
||||
begin
|
||||
// issue #26463
|
||||
if Assigned(Application) and (Application.ModalLevel > 0) then
|
||||
begin
|
||||
for i := Screen.CustomFormZOrderCount - 1 downto 0 do
|
||||
begin
|
||||
AForm := Screen.CustomFormsZOrdered[i];
|
||||
if AForm.HandleAllocated and AForm.Visible and (fsModal in AForm.FormState) then
|
||||
ShowWindow(AForm.Handle, SW_SHOWMINIMIZED);
|
||||
end;
|
||||
ShowWindow(Win32WidgetSet.AppHandle, SW_SHOWMINNOACTIVE);
|
||||
end else
|
||||
if Assigned(Application) and Application.MainFormOnTaskBar then
|
||||
Windows.SendMessage(Application.MainFormHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0)
|
||||
else
|
||||
Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0)
|
||||
Windows.SendMessage(FAppHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -179,7 +193,23 @@ end;
|
||||
Restore minimized whole application from taskbar
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWin32WidgetSet.AppRestore;
|
||||
var
|
||||
AForm: TCustomForm;
|
||||
i: Integer;
|
||||
begin
|
||||
// issue #26463
|
||||
if Assigned(Application) and (Application.ModalLevel > 0) then
|
||||
begin
|
||||
for i := Screen.CustomFormZOrderCount - 1 downto 0 do
|
||||
begin
|
||||
AForm := Screen.CustomFormsZOrdered[i];
|
||||
if AForm.HandleAllocated and AForm.Visible and (fsModal in AForm.FormState) then
|
||||
begin
|
||||
ShowWindow(AForm.Handle, SW_RESTORE);
|
||||
end;
|
||||
end;
|
||||
ShowWindow(FAppHandle, SW_RESTORE);
|
||||
end else
|
||||
if Assigned(Application) and Application.MainFormOnTaskBar then
|
||||
Windows.SendMessage(Application.MainFormHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user