mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 20:40:25 +02:00
win32 interface: fixed focus after restoring a minimized window (bug #7946)
git-svn-id: trunk@10340 -
This commit is contained in:
parent
c0f7e52665
commit
9bb80433b3
@ -736,39 +736,41 @@ Var
|
|||||||
|
|
||||||
SC_MINIMIZE:
|
SC_MINIMIZE:
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if (Application <> nil) and (lWinControl <> nil)
|
if (Application <> nil) and (lWinControl <> nil)
|
||||||
|
and (Application.MainForm <> nil)
|
||||||
and (Application.MainForm = lWinControl) then
|
and (Application.MainForm = lWinControl) then
|
||||||
Window := TWin32WidgetSet(WidgetSet).AppHandle;
|
Window := TWin32WidgetSet(WidgetSet).AppHandle;//redirection
|
||||||
if Window = TWin32WidgetSet(WidgetSet).AppHandle then
|
|
||||||
|
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
|
||||||
|
and (Application <> nil)
|
||||||
|
and (Application.MainForm<>nil) then
|
||||||
begin
|
begin
|
||||||
if (Application <> nil) and (Application.MainForm <> nil) and
|
|
||||||
Application.MainForm.HandleAllocated then
|
|
||||||
begin
|
|
||||||
//DebugLn('SC_MINIMIZE');
|
|
||||||
Application.IntfAppMinimize;
|
|
||||||
Windows.SetWindowPos(Window, HWND_TOP,
|
Windows.SetWindowPos(Window, HWND_TOP,
|
||||||
Application.MainForm.Left, Application.MainForm.Top,
|
Application.MainForm.Left, Application.MainForm.Top,
|
||||||
Application.MainForm.Width, 0, SWP_NOACTIVATE);
|
Application.MainForm.Width, 0, SWP_NOACTIVATE);
|
||||||
{$ifdef NO_TRIM_MEMORY}
|
if Application.MainForm.HandleAllocated then
|
||||||
{Do not trim working set of application in memory
|
Windows.ShowWindow(Application.MainForm.Handle,SW_HIDE);
|
||||||
according to: http://support.microsoft.com/kb/293215.
|
|
||||||
Useful for real-time I/O applications}
|
Application.IntfAppMinimize;
|
||||||
Windows.ShowWindow(Window, SW_SHOWMINIMIZED);
|
|
||||||
exit;
|
|
||||||
{$endif}
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SC_RESTORE:
|
SC_RESTORE:
|
||||||
begin
|
begin
|
||||||
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
|
|
||||||
and (Application <> nil) then
|
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
|
||||||
|
and (Application <> nil)
|
||||||
|
and (Application.MainForm<>nil)
|
||||||
|
and Application.MainForm.HandleAllocated then
|
||||||
begin
|
begin
|
||||||
//DebugLn('SC_RESTORE');
|
PLMsg^.Result := Windows.DefWindowProc(Window, WM_SYSCOMMAND, WParam, LParam);
|
||||||
|
Windows.ShowWindow(Application.MainForm.Handle,SW_SHOW);
|
||||||
|
if Windows.IsWindowEnabled(Application.MainForm.Handle)
|
||||||
|
then Windows.SetActiveWindow(Application.MainForm.Handle);
|
||||||
|
WinProcess := false;
|
||||||
|
|
||||||
Application.IntfAppRestore;
|
Application.IntfAppRestore;
|
||||||
if Application.MainForm.WindowState = wsMaximized then
|
|
||||||
Windows.ShowWindow(Application.MainForm.Handle, SW_MAXIMIZE);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user