keybinds: track submap at press for keypresses

fixes #5037
This commit is contained in:
Vaxry 2024-03-09 16:08:07 +00:00
parent c9ea600baa
commit 300d77edd9
2 changed files with 4 additions and 1 deletions

View file

@ -319,6 +319,7 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
.keycode = KEYCODE, .keycode = KEYCODE,
.modmaskAtPressTime = MODS, .modmaskAtPressTime = MODS,
.sent = true, .sent = true,
.submapAtPress = m_szCurrentSelectedSubmap,
}; };
bool suppressEvent = false; bool suppressEvent = false;
@ -349,7 +350,8 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
bool foundInPressedKeys = false; bool foundInPressedKeys = false;
for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) { for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) {
if (it->keycode == KEYCODE) { if (it->keycode == KEYCODE) {
suppressEvent = handleKeybinds(MODS, *it, false); if (it->submapAtPress == m_szCurrentSelectedSubmap)
handleKeybinds(MODS, *it, false);
foundInPressedKeys = true; foundInPressedKeys = true;
suppressEvent = !it->sent; suppressEvent = !it->sent;
it = m_dPressedKeys.erase(it); it = m_dPressedKeys.erase(it);

View file

@ -43,6 +43,7 @@ struct SPressedKeyWithMods {
uint32_t keycode = 0; uint32_t keycode = 0;
uint32_t modmaskAtPressTime = 0; uint32_t modmaskAtPressTime = 0;
bool sent = false; bool sent = false;
std::string submapAtPress = "";
}; };
struct SParsedKey { struct SParsedKey {