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
+9 -1
View File
@@ -514,7 +514,15 @@ begin
if (LPopup <> 0) and (LPopup <> LHwnd) and IsWindow(LPopup) then
begin
ShowWindow(LPopup, SW_SHOW);
SetForegroundWindow(LPopup);
// Not plain SetForegroundWindow: the hotkey is pressed from ANOTHER
// application, so we are not the foreground process and Windows refuses
// the call — the dialog was raised but never focused.
ForceForegroundWindow(LPopup);
// A tray balloon, not a toast: our own window is disabled and sits behind
// the dialog, so nothing rendered in the page would be seen.
FBridge.ShowBalloon('Finish the open dialog',
'A Save or folder dialog is waiting for an answer. Shortcuts stay ' +
'disabled until you close it.', True);
LogLine('Hotkey ignored — a native dialog is open; brought it to front.');
end;
end;