fix(autofill): page tenue eveillee dans le tray et au retour de veille

Premier autofill apres des heures cachee : la page mettait 3 a 5 s a
repondre, alors que les drapeaux anti-gel de Chromium etaient appliques.
Un ExecuteJavaScript trivial toutes les 5 min, et tout de suite a la sortie
de veille ou au deverrouillage de session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-10-02 23:13:05 +01:00
parent bcbbcebe16
commit 2cc8d1b62b
2 changed files with 34 additions and 0 deletions
+8
View File
@@ -109,6 +109,7 @@ type
// WinEvent hook that watches every foreground change in the session.
FForegroundHook: THandle;
FOnSystemLock: TProc;
FOnSystemResume: TProc;
// Set TRUE the moment Windows tells us the session is ending
// (WM_QUERYENDSESSION / WM_ENDSESSION). FormCloseQuery checks this
// to bypass the "minimize to tray" intercept so the form closes
@@ -296,6 +297,8 @@ type
property AutofillTotpActive: Boolean read FAutofillTotpActive;
// Fired on main thread when Windows locks the session (WTS_SESSION_LOCK).
property OnSystemLock: TProc read FOnSystemLock write FOnSystemLock;
// Sortie de veille ou session deverrouillee : de quoi reveiller la page.
property OnSystemResume: TProc read FOnSystemResume write FOnSystemResume;
// True once WM_QUERYENDSESSION (or WM_ENDSESSION) has been received.
// FormCloseQuery uses this to allow normal close during shutdown.
property ShutdownPending: Boolean read FShutdownPending;
@@ -406,6 +409,7 @@ const
const
WM_WTSSESSION_CHANGE = $02B1;
WTS_SESSION_LOCK = 7;
WTS_SESSION_UNLOCK = 8;
NOTIFY_FOR_THIS_SESSION = 0;
// Power management broadcast — sent to all top-level windows when the
@@ -1755,6 +1759,8 @@ begin
begin
if AMsg.WParam = WTS_SESSION_LOCK then
if Assigned(FOnSystemLock) then FOnSystemLock();
if AMsg.WParam = WTS_SESSION_UNLOCK then
if Assigned(FOnSystemResume) then FOnSystemResume();
end
else if AMsg.Msg = WM_POWERBROADCAST then
@@ -1768,6 +1774,8 @@ begin
// suspends — fast handler required (no UI prompts, no network).
if AMsg.WParam = PBT_APMSUSPEND then
if Assigned(FOnSystemLock) then FOnSystemLock();
if AMsg.WParam = PBT_APMRESUMEAUTOMATIC then
if Assigned(FOnSystemResume) then FOnSystemResume();
end
else if (AMsg.Msg = WM_QUERYENDSESSION) or (AMsg.Msg = WM_ENDSESSION) then