From 300d77edd9833db42c999a91271ae23a5be69ef2 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 9 Mar 2024 16:08:07 +0000 Subject: [PATCH] keybinds: track submap at press for keypresses fixes #5037 --- src/managers/KeybindManager.cpp | 4 +++- src/managers/KeybindManager.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index d1b72e53..d8a4ca46 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -319,6 +319,7 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard .keycode = KEYCODE, .modmaskAtPressTime = MODS, .sent = true, + .submapAtPress = m_szCurrentSelectedSubmap, }; bool suppressEvent = false; @@ -349,7 +350,8 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard bool foundInPressedKeys = false; for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) { if (it->keycode == KEYCODE) { - suppressEvent = handleKeybinds(MODS, *it, false); + if (it->submapAtPress == m_szCurrentSelectedSubmap) + handleKeybinds(MODS, *it, false); foundInPressedKeys = true; suppressEvent = !it->sent; it = m_dPressedKeys.erase(it); diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index 561ee1ab..07b77398 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -43,6 +43,7 @@ struct SPressedKeyWithMods { uint32_t keycode = 0; uint32_t modmaskAtPressTime = 0; bool sent = false; + std::string submapAtPress = ""; }; struct SParsedKey {