keybinds: fix keys without keysyms triggering random binds (#4739)

This commit is contained in:
rszyma 2024-02-19 01:02:03 +01:00 committed by GitHub
parent c6b1d82c70
commit 69a4f08dbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -518,6 +518,18 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
// oMg such performance hit!!11! // oMg such performance hit!!11!
// this little maneouver is gonna cost us 4µs // 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); const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY);
if (key.keysym != KBKEY && key.keysym != KBKEYUPPER) if (key.keysym != KBKEY && key.keysym != KBKEYUPPER)