From 7b568d7ad8989718a3f1fa9e23d366154ff1962b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:31:47 +0200 Subject: [PATCH] configure keyboards one by one --- src/managers/InputManager.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index d206cd7d8..0017a4f04 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -285,23 +285,30 @@ void CInputManager::setKeyboardLayout() { return; } + const auto PLASTKEEB = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat); + // TODO: configure devices one by one - for (auto& k : m_lKeyboards) + for (auto& k : m_lKeyboards) { wlr_keyboard_set_keymap(k.keyboard->keyboard, KEYMAP); - wlr_keyboard_modifiers wlrMods = {0}; + wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, k.keyboard->keyboard); + + wlr_keyboard_modifiers wlrMods = {0}; - if (g_pConfigManager->getInt("input:numlock_by_default") == 1) { - // lock numlock - const auto IDX = xkb_map_mod_get_index(KEYMAP, XKB_MOD_NAME_NUM); + if (g_pConfigManager->getInt("input:numlock_by_default") == 1) { + // lock numlock + const auto IDX = xkb_map_mod_get_index(KEYMAP, XKB_MOD_NAME_NUM); - if (IDX != XKB_MOD_INVALID) - wlrMods.locked |= (uint32_t)1 << IDX; - } - - if (wlrMods.locked != 0) { - wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &wlrMods); + if (IDX != XKB_MOD_INVALID) + wlrMods.locked |= (uint32_t)1 << IDX; + } + + if (wlrMods.locked != 0) { + wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &wlrMods); + } } + + wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, PLASTKEEB); xkb_keymap_unref(KEYMAP); xkb_context_unref(CONTEXT);