]> git.mdlowis.com Git - proto/labwc.git/commitdiff
keyboard: cancel keybind_repeat on reconfigure
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 30 Dec 2024 23:52:55 +0000 (00:52 +0100)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Tue, 31 Dec 2024 10:53:34 +0000 (19:53 +0900)
Currently we may end up in an endless loop of Reconfigure requests
if the Reconfigure action was called by a keybind. If the reconfigure
takes too long (which may happen on slow systems with libsfdo full
debug logging for example) the reconfigure might be triggered again
and again.

To prevent that, simply cancel all keybind_repeat timers on reconfigure.

include/input/keyboard.h
src/input/keyboard.c
src/server.c

index ff2d8500bfc69c793388f7d65ef1e0feec2111f8..2bd335a6203157723428bf1ada186b54b994358b 100644 (file)
@@ -20,6 +20,8 @@ void keyboard_setup_handlers(struct keyboard *keyboard);
 void keyboard_set_numlock(struct wlr_keyboard *keyboard);
 void keyboard_update_layout(struct seat *seat, xkb_layout_index_t layout);
 void keyboard_cancel_keybind_repeat(struct keyboard *keyboard);
+void keyboard_cancel_all_keybind_repeats(struct seat *seat);
+
 bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
 
 #endif /* LABWC_KEYBOARD_H */
index 6ab5fb91fe598d98f6da94a2000d868e6ba2a424..5931fb37dd10eb1fcda5616fea8f70dfe132b6d6 100644 (file)
@@ -619,6 +619,19 @@ keyboard_cancel_keybind_repeat(struct keyboard *keyboard)
        }
 }
 
+void
+keyboard_cancel_all_keybind_repeats(struct seat *seat)
+{
+       struct input *input;
+       struct keyboard *kb;
+       wl_list_for_each(input, &seat->inputs, link) {
+               if (input->wlr_input_device->type == WLR_INPUT_DEVICE_KEYBOARD) {
+                       kb = wl_container_of(input, kb, base);
+                       keyboard_cancel_keybind_repeat(kb);
+               }
+       }
+}
+
 static void
 keyboard_key_notify(struct wl_listener *listener, void *data)
 {
index 69015d4e0e4c6d17c35857599b94396e4aa13fa1..d5c31dc5066219cbd392a0cccfc817468c857f3b 100644 (file)
 #include <wlr/xwayland.h>
 #include "xwayland-shell-v1-protocol.h"
 #endif
+
 #include "drm-lease-v1-protocol.h"
 #include "common/macros.h"
 #include "config/rcxml.h"
 #include "config/session.h"
 #include "decorations.h"
+
 #if HAVE_LIBSFDO
 #include "desktop-entry.h"
 #endif
+
 #include "idle.h"
+#include "input/keyboard.h"
 #include "labwc.h"
 #include "layers.h"
 #include "magnifier.h"
@@ -92,6 +96,7 @@ handle_sighup(int signal, void *data)
 {
        struct server *server = data;
 
+       keyboard_cancel_all_keybind_repeats(&server->seat);
        session_environment_init();
        reload_config_and_theme(server);
        output_virtual_update_fallback(server);