seat: update keymap/repeat info on keymap events from keebs

fixes #6114
This commit is contained in:
Vaxry 2024-05-17 19:28:33 +01:00
parent 0cb8fbe18e
commit 23cd4c7998
3 changed files with 12 additions and 3 deletions

View file

@ -86,10 +86,15 @@ void CSeatManager::setKeyboard(SP<IKeyboard> KEEB) {
keyboard->active = false; keyboard->active = false;
keyboard = KEEB; keyboard = KEEB;
if (KEEB) { if (KEEB)
KEEB->active = true; 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(); PROTO::seat->updateKeymap();
} }

View file

@ -54,6 +54,7 @@ class CSeatManager {
void setMouse(SP<IPointer> mouse); void setMouse(SP<IPointer> mouse);
void setKeyboard(SP<IKeyboard> keeb); void setKeyboard(SP<IKeyboard> keeb);
void updateActiveKeyboardData(); // updates the clients with the keymap and repeat info
void setKeyboardFocus(wlr_surface* surf); void setKeyboardFocus(wlr_surface* surf);
void sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state); void sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state);

View file

@ -839,6 +839,9 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
auto PKEEB = ((IKeyboard*)owner)->self.lock(); auto PKEEB = ((IKeyboard*)owner)->self.lock();
const auto LAYOUT = PKEEB->getActiveLayout(); const auto LAYOUT = PKEEB->getActiveLayout();
if (PKEEB == g_pSeatManager->keyboard)
g_pSeatManager->updateActiveKeyboardData();
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->hlName + "," + LAYOUT}); g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->hlName + "," + LAYOUT});
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{PKEEB, LAYOUT})); EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{PKEEB, LAYOUT}));
}, },