mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Make keyboard repeat info configurable
This commit is contained in:
parent
703df2a671
commit
a3c0f97810
7 changed files with 69 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue