From e1b268af98edeb09e570e8855ef64f0719cbafe2 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sun, 4 Dec 2022 01:20:06 +0100 Subject: 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 --- sway/input/keyboard.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'sway/input/keyboard.c') diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 2ac02b22..96d5b72d 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c @@ -1070,9 +1070,6 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) { } } - struct wlr_seat *seat = keyboard->seat_device->sway_seat->wlr_seat; - wlr_seat_set_keyboard(seat, keyboard->wlr); - wl_list_remove(&keyboard->keyboard_key.link); wl_signal_add(&keyboard->wlr->events.key, &keyboard->keyboard_key); keyboard->keyboard_key.notify = handle_keyboard_key; -- cgit v1.2.3-54-g00ecf