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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfY7iFJEjmRXf1XGrTs4MF
This commit is contained in:
Henrik Rydgård
2026-08-27 20:52:07 +02:00
co-authored by Claude Opus 5
parent 518bc7a7fc
commit 8cb5ce7585
+5 -4
View File
@@ -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<std::mutex> guard(g_inputEventQueueLock);
g_inputEventQueue.push_back(ev);