Fix fallback when there are two config blocks for a keyboard

This commit is contained in:
emersion 2017-10-26 22:38:03 +02:00
parent 4e5d23daa9
commit c0c4816b13
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
4 changed files with 49 additions and 33 deletions

View file

@ -417,14 +417,12 @@ struct device_config *config_get_device(struct roots_config *config,
struct keyboard_config *config_get_keyboard(struct roots_config *config,
struct wlr_input_device *device) {
struct keyboard_config *kc;
struct keyboard_config *default_kc = NULL;
wl_list_for_each(kc, &config->keyboards, link) {
if (strcmp(kc->name, "*") == 0) {
default_kc = kc;
} else if (strcmp(kc->name, device->name) == 0) {
if ((device != NULL && strcmp(kc->name, device->name) == 0) ||
(device == NULL && strcmp(kc->name, "*") == 0)) {
return kc;
}
}
return default_kc;
return NULL;
}