From d0a4a0e0d8ecc0a47c0bcfbf84c090cae8cee7af Mon Sep 17 00:00:00 2001 From: Sungyoon Cho Date: Wed, 15 May 2024 00:14:43 +0900 Subject: input: fix modifier and leds (#6062) --- src/devices/IKeyboard.cpp | 11 ++++++++++- src/devices/IKeyboard.hpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/devices') diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp index 3bd42eac..7e4dd912 100644 --- a/src/devices/IKeyboard.cpp +++ b/src/devices/IKeyboard.cpp @@ -131,8 +131,17 @@ void IKeyboard::updateLEDs() { leds |= (1 << i); } + updateLEDs(leds); +} + +void IKeyboard::updateLEDs(uint32_t leds) { + auto keyboard = wlr(); + + if (!keyboard || keyboard->xkb_state == nullptr) + return; + if (isVirtual() && g_pInputManager->shouldIgnoreVirtualKeyboard(self.lock())) return; - wlr_keyboard_led_update(wlr(), leds); + wlr_keyboard_led_update(keyboard, leds); } diff --git a/src/devices/IKeyboard.hpp b/src/devices/IKeyboard.hpp index d90550da..ec58ff5b 100644 --- a/src/devices/IKeyboard.hpp +++ b/src/devices/IKeyboard.hpp @@ -42,6 +42,7 @@ class IKeyboard : public IHID { void updateXKBTranslationState(xkb_keymap* const keymap = nullptr); std::string getActiveLayout(); void updateLEDs(); + void updateLEDs(uint32_t leds); bool active = false; bool enabled = true; -- cgit v1.2.3