keybinds: fix NoSymbol keybinds (#7199)

This commit is contained in:
Ikalco 2024-08-07 06:22:19 -05:00 committed by GitHub
parent 5b736a4a66
commit a05da63d85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 6 deletions

View File

@ -639,18 +639,17 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
if (found || key.submapAtPress != m_szCurrentSelectedSubmap) if (found || key.submapAtPress != m_szCurrentSelectedSubmap)
continue; continue;
} else { } else {
// in this case, we only have the keysym to go off. // in this case, we only have the keysym to go off of for this keybind, and it's invalid
// if the keysym failed resolving, we can't do anything. It's likely missing // since there might be something like keycode to match with other keybinds, try the next
// from the keymap. if (key.keysym == XKB_KEY_NoSymbol)
if (key.keysym == 0) continue;
return false;
// 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_NO_FLAGS); const auto KBKEY = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_NO_FLAGS);
const auto KBKEYLOWER = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE); const auto KBKEYLOWER = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
if (KBKEY == 0 && KBKEYLOWER == 0) { if (KBKEY == XKB_KEY_NoSymbol && KBKEYLOWER == XKB_KEY_NoSymbol) {
// Keysym failed to resolve from the key name of the currently iterated bind. // Keysym failed to resolve from the key name of the currently iterated bind.
// This happens for names such as `switch:off:Lid Switch` as well as some keys // This happens for names such as `switch:off:Lid Switch` as well as some keys
// (such as yen and ro). // (such as yen and ro).