From: bi4k8 Date: Wed, 9 Nov 2022 20:29:48 +0000 (+0000) Subject: keyboard: use 1000/rate msecs for keybind repeat event source delay X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9ed800c5a194cf06373a087801ac8d3b77c678a9;p=proto%2Flabwc.git keyboard: use 1000/rate msecs for keybind repeat event source delay --- diff --git a/src/keyboard.c b/src/keyboard.c index 373bf2b5..b1aca0d4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -235,6 +235,7 @@ handle_keybind_repeat(void *data) { struct keyboard *keyboard = data; assert(keyboard->keybind_repeat); + assert(keyboard->keybind_repeat_rate > 0); /* synthesize event */ struct wlr_keyboard_key_event event = { @@ -243,8 +244,9 @@ handle_keybind_repeat(void *data) }; handle_compositor_keybindings(keyboard, &event); + int next_repeat_ms = 1000 / keyboard->keybind_repeat_rate; wl_event_source_timer_update(keyboard->keybind_repeat, - keyboard->keybind_repeat_rate); + next_repeat_ms); return 0; /* ignored per wl_event_loop docs */ }