diff options
Diffstat (limited to 'rootston/keyboard.c')
-rw-r--r-- | rootston/keyboard.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rootston/keyboard.c b/rootston/keyboard.c index 85033613..4aaf2d48 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -306,6 +306,12 @@ static void keyboard_config_merge(struct roots_keyboard_config *config, if (config->name == NULL) { config->name = fallback->name; } + if (config->repeat_rate <= 0) { + config->repeat_rate = fallback->repeat_rate; + } + if (config->repeat_delay <= 0) { + config->repeat_delay = fallback->repeat_delay; + } } struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, @@ -337,8 +343,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, keyboard_config_merge(config, &env_config); keyboard->config = config; - struct xkb_rule_names rules; - memset(&rules, 0, sizeof(rules)); + struct xkb_rule_names rules = { 0 }; rules.rules = config->rules; rules.model = config->model; rules.layout = config->layout; @@ -353,6 +358,10 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS)); xkb_context_unref(context); + int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25; + int repeat_delay = (config->repeat_delay > 0) ? config->repeat_delay : 600; + wlr_keyboard_set_repeat_info(device->keyboard, repeat_rate, repeat_delay); + return keyboard; } |