aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2022-12-04 01:20:06 +0100
committerLibravatar Ronan Pigott <rpigott@berkeley.edu>2022-12-04 13:01:41 -0700
commite1b268af98edeb09e570e8855ef64f0719cbafe2 (patch)
treed0cdfc81540dcdb2603e57b8f5acbd9433a2249d /sway/input/input-manager.c
parentsway/lock: handle mode in output commit handler (diff)
downloadsway-e1b268af98edeb09e570e8855ef64f0719cbafe2.tar.gz
sway-e1b268af98edeb09e570e8855ef64f0719cbafe2.tar.zst
sway-e1b268af98edeb09e570e8855ef64f0719cbafe2.zip
seat: Avoid sending redundant keymaps on reload
When we reload the config, we reset every input device and re-apply configuration from the config file. This means that the keyboard keymap is updated at least once during config reload, more if the config file contains keyboard configuration. When they keyboard keymap changes and is updated through wlr_seat, the keymap ends up sent to every keyboard bound in every client, seemingly multiple times. On an x230 of mine with a keyboard layout set in the config file, I see 42 keymap events sent to foot on config reload. Reduce events from keyboard configurations by skipping all but the currently active keyboard for the seat, and by clearing the active keyboard during input manager device reset. After this change, I only see a single just-in-time keymap event. Fixes: https://github.com/swaywm/sway/issues/6654
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r--sway/input/input-manager.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 634d8981..ea2cc038 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -593,6 +593,13 @@ void input_manager_reset_input(struct sway_input_device *input_device) {
593} 593}
594 594
595void input_manager_reset_all_inputs(void) { 595void input_manager_reset_all_inputs(void) {
596 // Set the active keyboard to NULL to avoid spamming configuration updates
597 // for all keyboard devices.
598 struct sway_seat *seat;
599 wl_list_for_each(seat, &server.input->seats, link) {
600 wlr_seat_set_keyboard(seat->wlr_seat, NULL);
601 }
602
596 struct sway_input_device *input_device = NULL; 603 struct sway_input_device *input_device = NULL;
597 wl_list_for_each(input_device, &server.input->devices, link) { 604 wl_list_for_each(input_device, &server.input->devices, link) {
598 input_manager_reset_input(input_device); 605 input_manager_reset_input(input_device);
@@ -601,7 +608,6 @@ void input_manager_reset_all_inputs(void) {
601 // If there is at least one keyboard using the default keymap, repeat delay, 608 // If there is at least one keyboard using the default keymap, repeat delay,
602 // and repeat rate, then it is possible that there is a keyboard group that 609 // and repeat rate, then it is possible that there is a keyboard group that
603 // need their keyboard disarmed. 610 // need their keyboard disarmed.
604 struct sway_seat *seat;
605 wl_list_for_each(seat, &server.input->seats, link) { 611 wl_list_for_each(seat, &server.input->seats, link) {
606 struct sway_keyboard_group *group; 612 struct sway_keyboard_group *group;
607 wl_list_for_each(group, &seat->keyboard_groups, link) { 613 wl_list_for_each(group, &seat->keyboard_groups, link) {