commit c4d83bf715920edcb3afe39c5b505e525c548df9
parent 975ad56221d4545bdd44d14fdd4cac796de207d9
Author: wh1tepearl <wh1tepearl@tutamail.com>
Date: Mon, 20 Jul 2026 17:41:13 +0100
Allow compositor to set keyboard repeate rate/delay
Export swc_repeat_rate and swc_repeat_delay so compositors can configure key repetition.
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libswc/keyboard.c b/libswc/keyboard.c
@@ -41,7 +41,11 @@
#include <unistd.h>
#include <xkbcommon/xkbcommon.h>
-static const int repeat_delay = 500, repeat_rate = 40;
+/* Keyboard repeat rate (characters per second) and delay (ms)
+ * defaults, used if compositor didnt set them.
+ */
+__attribute__((visibility("default")))
+int32_t swc_repeat_rate = 40, swc_repeat_delay = 500;
static void
enter(struct input_focus_handler *handler,
@@ -384,7 +388,7 @@ keyboard_bind(struct keyboard *keyboard,
if (version >= 4) {
wl_keyboard_send_repeat_info(
- client_resource, repeat_rate, repeat_delay);
+ client_resource, swc_repeat_rate, swc_repeat_delay);
}
return client_resource;
diff --git a/libswc/swc.h b/libswc/swc.h
@@ -551,6 +551,11 @@ swc_window_stack(struct swc_window *window, int32_t direction);
/* }}} */
+/* Keyboard repeat rate (characters per second) and delay (ms) definitions.
+ * Exposed as extern so compositors can set them.
+ */
+extern int32_t swc_repeat_rate, swc_repeat_delay;
+
/* Bindings {{{ */
enum {