diff --git a/delphi-backend/Source/PM.Bridge.pas b/delphi-backend/Source/PM.Bridge.pas index eabf502..67d069f 100644 --- a/delphi-backend/Source/PM.Bridge.pas +++ b/delphi-backend/Source/PM.Bridge.pas @@ -163,8 +163,9 @@ type // settings_json : elle peut etre allumee coffre ferme, quand aucune session // n'existe pour lire les reglages du serveur. FLazyAlphaPct: Integer; - // Voir la propriete LastFillWaits. + // Voir les proprietes LastFillWaits et LastRequestFromBar. FLastFillWaits: string; + FLastRequestFromBar: Boolean; // Dernier etat connu du survol, pour ne reposer l'opacite que sur un // changement - SetLayeredWindowAttributes force un repaint a chaque appel. FLazyHover: Boolean; @@ -179,7 +180,8 @@ type // Capture the foreground window and hand it to the host. Shared by the // autofill hotkeys and the lazy strip - same target, same title matching, // same picker. Only the gesture differs. - procedure FireAutofillRequest(AKind: TAutofillKind); + procedure FireAutofillRequest(AKind: TAutofillKind; + AFromBar: Boolean = False); procedure MsgWindowHandler(var AMsg: TMessage); procedure PrepareNid; procedure ShowTrayMenu; @@ -257,6 +259,9 @@ type /// l'hote. Une chaine plutot qu'un evenement : ExecuteAutofill s'execute /// sur le thread principal, juste avant que l'hote journalise. property LastFillWaits: string read FLastFillWaits; + /// Le dernier remplissage venait-il de la barrette plutot que d'un + /// raccourci ? Les deux chemins se rejoignent des FireAutofillRequest. + property LastRequestFromBar: Boolean read FLastRequestFromBar; property SecureClipboard: TSecureClipboard read FSecureClipboard; property TrayAdded: Boolean read FTrayAdded; // Show or hide the lazy strip. Idempotent, and remembered across launches. @@ -1063,13 +1068,18 @@ end; // The target of a fill is whatever window owns the foreground at the moment // the user asks for it - a shortcut, or a click on the lazy strip, which takes // no foreground precisely so this stays true. -procedure TPMBridge.FireAutofillRequest(AKind: TAutofillKind); +procedure TPMBridge.FireAutofillRequest(AKind: TAutofillKind; + AFromBar: Boolean = False); var LTarget: HWND; LTitle: string; LLen: Integer; begin if not Assigned(FOnAutofillRequest) then Exit; + // QUI A DEMANDE. Les deux gestes partagent tout ce qui suit, donc le journal + // les confondait sous "hotkey" - et un diagnostic de lenteur qui ne sait pas + // par ou l'on est entre cherche au mauvais endroit. + FLastRequestFromBar := AFromBar; LTarget := GetForegroundWindow; CaptureForegroundOwner; // Hiding to the tray does not hand the foreground to anyone else, so ours @@ -1303,9 +1313,9 @@ begin if HiWord(AMsg.WParam) = BN_CLICKED then begin case LoWord(AMsg.WParam) of - LAZY_ID_FULL: FireAutofillRequest(akFull); - LAZY_ID_PWD: FireAutofillRequest(akPasswordOnly); - LAZY_ID_TOTP: FireAutofillRequest(akTotp); + LAZY_ID_FULL: FireAutofillRequest(akFull, True); + LAZY_ID_PWD: FireAutofillRequest(akPasswordOnly, True); + LAZY_ID_TOTP: FireAutofillRequest(akTotp, True); LAZY_ID_OPEN: if Assigned(FOnTrayRestore) then FOnTrayRestore(); LAZY_ID_CLOSE: PostMessage(FMsgWindow, WM_LAZY_CLOSE, 0, 0); end; diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 06b1557..cc19e67 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -1978,7 +1978,8 @@ begin WebBrowser.ExecuteJavaScript( 'if(window.Bridge&&typeof Bridge.onAutofillRequest==="function")' + 'Bridge.onAutofillRequest("' + LTitle + '","' + LKind + '")'); - LogLine('Autofill hotkey (' + LKind + ') — foreground: "' + ATitle + '"'); + LogLine('Autofill ' + IfThen(FBridge.LastRequestFromBar, 'fill bar', 'hotkey') + + ' (' + LKind + ') — foreground: "' + ATitle + '"'); end; initialization