fix(hotkeys): focus the buried dialog and say why the shortcut did nothing

SetForegroundWindow is refused when the hotkey comes from another application, so the dialog was raised but never focused; ForceForegroundWindow is now exposed by PM.Bridge for that. The explanation goes through a tray balloon because our window is disabled and behind the dialog, where no toast would be seen.
This commit is contained in:
r-zakarya
2026-08-01 18:49:03 +01:00
parent 1c0423680d
commit c9c1e98470
3 changed files with 17 additions and 3 deletions
+6 -1
View File
@@ -272,6 +272,12 @@ type
read FOnQuickSearchHotkey write FOnQuickSearchHotkey;
end;
// Bring a window to the foreground despite the Win10/11 anti-focus-stealing
// rules (AttachThreadInput + poll). Exposed because the host needs it to raise
// a native dialog of ours that got buried — plain SetForegroundWindow is
// refused when we are not the foreground process.
function ForceForegroundWindow(ATargetHwnd: HWND): Boolean;
implementation
uses
@@ -307,7 +313,6 @@ function UnhookWinEvent(hWinEventHook: THandle): BOOL;
// Defined further down but needed by the constructor / MinimizeToTray.
function IsOwnProcessWindow(AHwnd: HWND): Boolean; forward;
function IsShellWindow(AHwnd: HWND): Boolean; forward;
function ForceForegroundWindow(ATargetHwnd: HWND): Boolean; forward;
procedure ForegroundEventProc(hWinEventHook: THandle; AEvent: DWORD; AWnd: HWND;
idObject, idChild: LongInt; idEventThread, dwmsEventTime: DWORD); stdcall; forward;