From 8cb5ce7585919bea86b112e9dded30737fe9fc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 27 Aug 2026 20:52:07 +0200 Subject: [PATCH] Restore the modifier flags on key events reaching the UI NativeKey builds a copy of the key with the Ctrl/Shift/Alt/Meta flags attached, but has been queueing the original ever since a47edbf6ef moved the dispatch from a direct g_screenManager->key(modKey) call to the event queue - so modKey has just been dead since then, and nothing downstream ever sees a modifier. That's every shortcut matched on one: Ctrl+Tab tab switching in ChoiceStrip, Ctrl+F in the game list, and Ctrl+C/V/Z in text fields. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SfY7iFJEjmRXf1XGrTs4MF --- UI/NativeApp.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index add9481018..8253b8e717 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1657,12 +1657,13 @@ bool NativeKey(const KeyInput &key) { modifierFlags |= KeyInputFlags::ModMeta; } - KeyInput modKey = key; - modKey.flags |= modifierFlags; + // Everything below here gets the key with the modifiers attached, since that's what the + // keyboard shortcuts in the screens are matched against. + const KeyInput modKey{ key.deviceId, key.keyCode, key.flags | modifierFlags }; bool retval = false; - UI::KeyEventResult kev = UI::KeyEventToFocusMoves(key); + UI::KeyEventResult kev = UI::KeyEventToFocusMoves(modKey); if (!(key.flags & KeyInputFlags::IS_REPEAT)) { // If a repeat, we follow what KeyEventToFocusMoves set it to. // Otherwise we signal that we used the key, always. @@ -1683,7 +1684,7 @@ bool NativeKey(const KeyInput &key) { // Queue up the key event for synchronous processing in the UI. QueuedEvent ev{}; ev.type = QueuedEventType::KEY; - ev.key = key; + ev.key = modKey; { std::lock_guard guard(g_inputEventQueueLock); g_inputEventQueue.push_back(ev);