From 23cd4c7998cc4308e5db9b64994ebd6b27c38877 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 17 May 2024 19:28:33 +0100 Subject: [PATCH] seat: update keymap/repeat info on keymap events from keebs fixes #6114 --- src/managers/SeatManager.cpp | 11 ++++++++--- src/managers/SeatManager.hpp | 1 + src/managers/input/InputManager.cpp | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp index 2087122a..bbbe01d4 100644 --- a/src/managers/SeatManager.cpp +++ b/src/managers/SeatManager.cpp @@ -86,10 +86,15 @@ void CSeatManager::setKeyboard(SP KEEB) { keyboard->active = false; keyboard = KEEB; - if (KEEB) { + if (KEEB) KEEB->active = true; - PROTO::seat->updateRepeatInfo(KEEB->wlr()->repeat_info.rate, KEEB->wlr()->repeat_info.delay); - } + + updateActiveKeyboardData(); +} + +void CSeatManager::updateActiveKeyboardData() { + if (keyboard) + PROTO::seat->updateRepeatInfo(keyboard->wlr()->repeat_info.rate, keyboard->wlr()->repeat_info.delay); PROTO::seat->updateKeymap(); } diff --git a/src/managers/SeatManager.hpp b/src/managers/SeatManager.hpp index cf5e9216..fee3efa9 100644 --- a/src/managers/SeatManager.hpp +++ b/src/managers/SeatManager.hpp @@ -54,6 +54,7 @@ class CSeatManager { void setMouse(SP mouse); void setKeyboard(SP keeb); + void updateActiveKeyboardData(); // updates the clients with the keymap and repeat info void setKeyboardFocus(wlr_surface* surf); void sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 58e5ad17..e05520f4 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -839,6 +839,9 @@ void CInputManager::setupKeyboard(SP keeb) { auto PKEEB = ((IKeyboard*)owner)->self.lock(); const auto LAYOUT = PKEEB->getActiveLayout(); + if (PKEEB == g_pSeatManager->keyboard) + g_pSeatManager->updateActiveKeyboardData(); + g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->hlName + "," + LAYOUT}); EMIT_HOOK_EVENT("activeLayout", (std::vector{PKEEB, LAYOUT})); },