commit c4d83bf

wh1tepearl  ·  2026-07-20 16:41:13 +0000 UTC
parent 975ad56
Allow compositor to set keyboard repeate rate/delay

Export swc_repeat_rate and swc_repeat_delay so compositors can configure key repetition.
2 files changed,  +11, -2
+6, -2
 1@@ -41,7 +41,11 @@
 2 #include <unistd.h>
 3 #include <xkbcommon/xkbcommon.h>
 4 
 5-static const int repeat_delay = 500, repeat_rate = 40;
 6+/* Keyboard repeat rate (characters per second) and delay (ms) 
 7+ * defaults, used if compositor didnt set them.
 8+ */
 9+__attribute__((visibility("default")))
10+int32_t swc_repeat_rate = 40, swc_repeat_delay = 500;
11 
12 static void
13 enter(struct input_focus_handler *handler,
14@@ -384,7 +388,7 @@ keyboard_bind(struct keyboard *keyboard,
15 
16 	if (version >= 4) {
17 		wl_keyboard_send_repeat_info(
18-		    client_resource, repeat_rate, repeat_delay);
19+		    client_resource, swc_repeat_rate, swc_repeat_delay);
20 	}
21 
22 	return client_resource;
+5, -0
 1@@ -551,6 +551,11 @@ swc_window_stack(struct swc_window *window, int32_t direction);
 2 
 3 /* }}} */
 4 
 5+/* Keyboard repeat rate (characters per second) and delay (ms) definitions.
 6+ * Exposed as extern so compositors can set them. 
 7+ */
 8+extern int32_t swc_repeat_rate, swc_repeat_delay;
 9+
10 /* Bindings {{{ */
11 
12 enum {