diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/keyboard.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 49241db8..643ff510 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <wlr/backend/multi.h> | 3 | #include <wlr/backend/multi.h> |
4 | #include <wlr/backend/session.h> | 4 | #include <wlr/backend/session.h> |
5 | #include <wlr/types/wlr_idle.h> | 5 | #include <wlr/types/wlr_idle.h> |
6 | #include <wlr/interfaces/wlr_keyboard.h> | ||
6 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
7 | #include "sway/desktop/transaction.h" | 8 | #include "sway/desktop/transaction.h" |
8 | #include "sway/input/input-manager.h" | 9 | #include "sway/input/input-manager.h" |
@@ -385,6 +386,31 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) { | |||
385 | keyboard->keymap = keymap; | 386 | keyboard->keymap = keymap; |
386 | wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap); | 387 | wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap); |
387 | 388 | ||
389 | xkb_mod_mask_t locked_mods = 0; | ||
390 | if (!input_config || input_config->xkb_numlock != 0) { | ||
391 | xkb_mod_index_t mod_index = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_NUM); | ||
392 | if (mod_index != XKB_MOD_INVALID) { | ||
393 | locked_mods |= (uint32_t)1 << mod_index; | ||
394 | } | ||
395 | } | ||
396 | if (input_config && input_config->xkb_capslock > 0) { | ||
397 | xkb_mod_index_t mod_index = xkb_map_mod_get_index(keymap, XKB_MOD_NAME_CAPS); | ||
398 | if (mod_index != XKB_MOD_INVALID) { | ||
399 | locked_mods |= (uint32_t)1 << mod_index; | ||
400 | } | ||
401 | } | ||
402 | if (locked_mods) { | ||
403 | wlr_keyboard_notify_modifiers(wlr_device->keyboard, 0, 0, locked_mods, 0); | ||
404 | uint32_t leds = 0; | ||
405 | for (uint32_t i = 0; i < WLR_LED_COUNT; ++i) { | ||
406 | if (xkb_state_led_index_is_active(wlr_device->keyboard->xkb_state, | ||
407 | wlr_device->keyboard->led_indexes[i])) { | ||
408 | leds |= (1 << i); | ||
409 | } | ||
410 | } | ||
411 | wlr_keyboard_led_update(wlr_device->keyboard, leds); | ||
412 | } | ||
413 | |||
388 | if (input_config && input_config->repeat_delay != INT_MIN | 414 | if (input_config && input_config->repeat_delay != INT_MIN |
389 | && input_config->repeat_rate != INT_MIN) { | 415 | && input_config->repeat_rate != INT_MIN) { |
390 | wlr_keyboard_set_repeat_info(wlr_device->keyboard, | 416 | wlr_keyboard_set_repeat_info(wlr_device->keyboard, |