diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-12-08 15:47:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 15:47:11 -0500 |
commit | eb4e91f96d206ff05ac7f6bb1972bf48f45e5e5e (patch) | |
tree | eab75ecb0f188786cd78286d09ebffb525ae74e1 /rootston/keyboard.c | |
parent | 381a646d2fbcb1b488e1551438444ac267f39138 (diff) | |
parent | 2c6e52c164cfd19bac642d3507fb8584a0201845 (diff) |
Merge pull request #474 from emersion/customize-repeat-info
Make keyboard repeat info configurable
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; } |