summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorrszyma <rszyma.dev@gmail.com>2024-02-19 01:02:03 +0100
committerGitHub <noreply@github.com>2024-02-19 00:02:03 +0000
commit69a4f08dbee6dc08d1e2ce498ce80ab20844e4f3 (patch)
tree82988991350ea2c753dad1a5feacae9d451f49aa /src/managers/KeybindManager.cpp
parentc6b1d82c70290faf051b82a9d2968f52a08c242e (diff)
keybinds: fix keys without keysyms triggering random binds (#4739)
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 0d2b7ecc..de0f5fbc 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -517,7 +517,19 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
} else {
// oMg such performance hit!!11!
// this little maneouver is gonna cost us 4µs
- const auto KBKEY = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
+ const auto KBKEY = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
+
+ if (KBKEY == 0) {
+ // Keysym failed to resolve from the key name of the the currently iterated bind.
+ // This happens for names such as `switch:off:Lid Switch` as well as some keys
+ // (such as yen and ro).
+ //
+ // We can't let compare a 0-value with currently pressed key below,
+ // because if this key also have no keysym (i.e. key.keysym == 0) it will incorrectly trigger the
+ // currently iterated bind. That's confirmed to be happening with yen and ro keys.
+ continue;
+ }
+
const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY);
if (key.keysym != KBKEY && key.keysym != KBKEYUPPER)