diff options
author | drendog <[email protected]> | 2024-04-24 00:30:35 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-23 23:30:35 +0100 |
commit | 31d055f6d487bd72fca5b10822e3f3bd95e94cc9 (patch) | |
tree | 284859e462fb40febcd9fe9e408f5eae42cc4872 | |
parent | d119513749daf47b9061258a1974b34111ab8bb5 (diff) | |
download | Hyprland-31d055f6d487bd72fca5b10822e3f3bd95e94cc9.tar.gz Hyprland-31d055f6d487bd72fca5b10822e3f3bd95e94cc9.zip |
input: fix active keyboard for seat after destroying one (#5725)
* fix: manage active keyboard for seat after destroying one
* chore: clang-format
-rw-r--r-- | src/managers/input/InputManager.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 0aad3189..b5d6bb5c 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1152,17 +1152,16 @@ void CInputManager::destroyKeyboard(SKeyboard* pKeyboard) { xkb_state_unref(pKeyboard->xkbTranslationState); - if (pKeyboard->active) { - m_lKeyboards.remove(*pKeyboard); + m_lKeyboards.remove(*pKeyboard); - if (m_lKeyboards.size() > 0) { - m_pActiveKeyboard = &m_lKeyboards.back(); - m_pActiveKeyboard->active = true; - } else { - m_pActiveKeyboard = nullptr; - } - } else - m_lKeyboards.remove(*pKeyboard); + if (m_lKeyboards.size() > 0) { + m_pActiveKeyboard = &m_lKeyboards.back(); + m_pActiveKeyboard->active = true; + wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, wlr_keyboard_from_input_device(m_pActiveKeyboard->keyboard)); + } else { + m_pActiveKeyboard = nullptr; + wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, nullptr); + } } void CInputManager::destroyMouse(wlr_input_device* mouse) { |