From c3563a2d6f2fe945785c0f92bde93df0991a3533 Mon Sep 17 00:00:00 2001 From: Jordan Russell Date: Mon, 2 Dec 2024 04:25:59 -0600 Subject: [PATCH] IDE: Set Application.MainFormOnTaskBar=True Fixes two issues (seen on Windows 11): - No animation when minimizing and restoring - If you maximized the window, then minimized, then moved the mouse over the taskbar thumbnail, the window was shown in an incorrect position, partly off the edge of the screen. It can't be enabled for /WIZARD currently because MainForm is hidden in that case. --- Projects/Compil32.dpr | 3 +++ Projects/Src/IDE.MainForm.pas | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Projects/Compil32.dpr b/Projects/Compil32.dpr index 512a4b876..da18d5f01 100644 --- a/Projects/Compil32.dpr +++ b/Projects/Compil32.dpr @@ -214,6 +214,9 @@ begin CheckParams; RegisterApplicationRestart; + if not CommandLineWizard then + Application.MainFormOnTaskBar := True; + { The 'with' is so that the Delphi IDE doesn't mess with these } with Application do begin if CommandLineWizard then diff --git a/Projects/Src/IDE.MainForm.pas b/Projects/Src/IDE.MainForm.pas index fefc4af5c..2dcbdb41f 100644 --- a/Projects/Src/IDE.MainForm.pas +++ b/Projects/Src/IDE.MainForm.pas @@ -1110,7 +1110,11 @@ destructor TMainForm.Destroy; Ini.WriteInteger('State', 'WindowTop', WindowPlacement.rcNormalPosition.Top); Ini.WriteInteger('State', 'WindowRight', WindowPlacement.rcNormalPosition.Right); Ini.WriteInteger('State', 'WindowBottom', WindowPlacement.rcNormalPosition.Bottom); - Ini.WriteBool('State', 'WindowMaximized', WindowState = wsMaximized); + { The GetWindowPlacement docs claim that "flags" is always zero. + Fortunately, that's wrong. WPF_RESTORETOMAXIMIZED is set when the + window is either currently maximized, or currently minimized from a + previous maximized state. } + Ini.WriteBool('State', 'WindowMaximized', WindowPlacement.flags and WPF_RESTORETOMAXIMIZED <> 0); Ini.WriteInteger('State', 'StatusPanelHeight', FromCurrentPPI(StatusPanel.Height)); { Zoom state }