Skip to content

Commit

Permalink
input: fix active keyboard for seat after destroying one (#5725)
Browse files Browse the repository at this point in the history
* fix: manage active keyboard for seat after destroying one

* chore: clang-format
  • Loading branch information
drendog committed Apr 23, 2024
1 parent d119513 commit 31d055f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/managers/input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 31d055f

Please sign in to comment.