From 99b68c3e67cf3e7f803a36a4319c6340b1f75329 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:18:19 +0100 Subject: [PATCH] docs(startup): correct the rationale for the deferred server start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comment justified deferring btnStartClick by the taskbar-proxy exposure window, which the .dpr fix has since removed. Kept as-is per decision — it works and reaching the tray sooner is desirable — but the comment now says that, so nobody "fixes" it later against a premise that no longer holds. Co-Authored-By: Claude Opus 4.8 --- delphi-backend/PMServer.dproj | 1 - delphi-backend/UMainForm.pas | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/delphi-backend/PMServer.dproj b/delphi-backend/PMServer.dproj index 75c9618..3f83454 100644 --- a/delphi-backend/PMServer.dproj +++ b/delphi-backend/PMServer.dproj @@ -204,7 +204,6 @@ $(PreBuildEvent)]]> PMServer_Icon1.ico app.png app.png - -tray diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 0319ba2..c80bfa8 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -334,15 +334,17 @@ begin end; end; // Starting the server (DB open + Indy bind + WebView2 navigation) is what - // makes FormCreate run for ~1 s. The FMX taskbar proxy is created somewhere - // inside that second, and since the thread never pumps a message while it - // runs, nothing can hide the proxy until it is over — that is the taskbar - // button sitting there during the Windows logon. + // makes FormCreate run for ~1 s. On a --tray launch it therefore runs AFTER + // the tray hide, in the deferred block below, so FormCreate returns in + // milliseconds and the app is tray-resident right away. // - // On a --tray launch, do it AFTER the tray hide instead: FormCreate then - // returns in milliseconds, MinimizeToTray runs immediately, and the proxy is - // gone before it can be drawn. A normal launch is unchanged (the window is - // meant to be on screen anyway, so ordering does not matter there). + // NOTE: this was originally needed to shrink the window during which the FMX + // taskbar proxy was visible. That is no longer the reason — the proxy is now + // dealt with properly in the .dpr (StartTrayProxyHider, WS_EX_TOOLWINDOW). + // The ordering is kept because it works and reaching the tray sooner is + // desirable, NOT because anything depends on it. A normal launch keeps the + // original order. FServer is constructed earlier (see above), so FServer.Active + // reads False rather than faulting while the start is pending. if not FindCmdLineSwitch('tray', True) then btnStartClick(Nil); btnToggleLogClick(nil);