From 6f7377f38138af5e41f094fbae90b4f68e94d49b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 9 Jul 2022 23:24:08 +0200 Subject: [PATCH] accumulate mods from all kbs for keybind processing --- src/managers/input/InputManager.cpp | 13 ++++++++++++- src/managers/input/InputManager.hpp | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 883b5b5e8..c2c154f10 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -595,7 +595,7 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar const xkb_keysym_t* keysyms; int syms = xkb_state_key_get_syms(pKeyboard->keyboard->keyboard->xkb_state, KEYCODE, &keysyms); - const auto MODS = wlr_keyboard_get_modifiers(pKeyboard->keyboard->keyboard); + const auto MODS = accumulateModsFromAllKBs(); wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat); @@ -735,4 +735,15 @@ void CInputManager::updateCapabilities(wlr_input_device* pDev) { } wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, m_uiCapabilities); +} + +uint32_t CInputManager::accumulateModsFromAllKBs() { + + uint32_t finalMask = 0; + + for (auto& kb : m_lKeyboards) { + finalMask |= wlr_keyboard_get_modifiers(kb.keyboard->keyboard); + } + + return finalMask; } \ No newline at end of file diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 3c91718c6..8cbfcfdb4 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -91,6 +91,9 @@ private: STabletTool* ensureTabletToolPresent(wlr_tablet_tool*); void applyConfigToKeyboard(SKeyboard*); + + // for shared mods + uint32_t accumulateModsFromAllKBs(); }; inline std::unique_ptr g_pInputManager; \ No newline at end of file