aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-02-10 12:36:30 -0500
committerDrew DeVault <sir@cmpwn.com>2019-02-11 10:22:53 -0500
commit062da8eae76710e7766dceef7556261429123585 (patch)
treec61a7f8ef1d296345c8fba1c8d15db9183aaf0f3
parent95e16bb744679296aaab5c0e9b8f3995fb2b4be4 (diff)
downloadsway-062da8eae76710e7766dceef7556261429123585.zip
sway-062da8eae76710e7766dceef7556261429123585.tar.gz
sway-062da8eae76710e7766dceef7556261429123585.tar.bz2
input/keyboard: respect solo repeat_{rate,delay}
If `repeat_rate` or `repeat_delay` is set without the other being set, the default was being used for both. This changes the logic to respect the value given and use the default for the other when only one is set.
-rw-r--r--sway/input/keyboard.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index efd27f7..00fc6a1 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -549,13 +549,17 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
wlr_keyboard_led_update(wlr_device->keyboard, leds);
}
- if (input_config && input_config->repeat_delay != INT_MIN
- && input_config->repeat_rate != INT_MIN) {
- wlr_keyboard_set_repeat_info(wlr_device->keyboard,
- input_config->repeat_rate, input_config->repeat_delay);
- } else {
- wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600);
+ int repeat_rate = 25;
+ if (input_config && input_config->repeat_rate != INT_MIN) {
+ repeat_rate = input_config->repeat_rate;
+ }
+ int repeat_delay = 600;
+ if (input_config && input_config->repeat_delay != INT_MIN) {
+ repeat_delay = input_config->repeat_delay;
}
+ wlr_keyboard_set_repeat_info(wlr_device->keyboard, repeat_rate,
+ repeat_delay);
+
xkb_context_unref(context);
struct wlr_seat *seat = keyboard->seat_device->sway_seat->wlr_seat;
wlr_seat_set_keyboard(seat, wlr_device);