From fa22f9521a41cb5b8621a8f62b53ceb852d294a7 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 11 Aug 2023 12:54:18 -0700 Subject: [PATCH] never suppress sdl key events when modifier keys are active --- library/Core.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index 9df45a869..ec64e6231 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2400,9 +2400,13 @@ bool Core::DFH_SDL_Event(SDL_Event* ev) DEBUG(keybinding).print("key down: sym=%d (%c)\n", sym, sym); bool handled = SelectHotkey(sym, modstate); if (handled) { + hotkey_states[sym] = true; + if (modstate & (DFH_MOD_CTRL | DFH_MOD_ALT)) { + DEBUG(keybinding).print("modifier key detected; not inhibiting SDL key down event\n"); + return false; + } DEBUG(keybinding).print("%sinhibiting SDL key down event\n", suppress_duplicate_keyboard_events ? "" : "not "); - hotkey_states[sym] = true; return suppress_duplicate_keyboard_events; } } @@ -2414,7 +2418,11 @@ bool Core::DFH_SDL_Event(SDL_Event* ev) } else if (ev->type == SDL_TEXTINPUT) { auto &te = ev->text; - DEBUG(keybinding).print("text input: '%s'\n", te.text); + DEBUG(keybinding).print("text input: '%s' (modifiers: %s%s%s)\n", + te.text, + modstate & DFH_MOD_SHIFT ? "Shift" : "", + modstate & DFH_MOD_CTRL ? "Ctrl" : "", + modstate & DFH_MOD_ALT ? "Alt" : ""); if (strlen(te.text) == 1 && hotkey_states[te.text[0]]) { DEBUG(keybinding).print("%sinhibiting SDL text event\n", suppress_duplicate_keyboard_events ? "" : "not ");