From dd024ae722d31ab69b3c05a07dbac5e72154b25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 22 Jun 2017 18:40:57 +0200 Subject: [PATCH] keyboard: Consider additional bindings in uniqueness checks We now have everything in place to extend the uniqueness check to consider all bindings of an item rather than just the first one. With this it is finally possible to set Alt+Tab as binding for "Switch windows" without keeping the hidden Alt+Tab binding of the "Switch applications" shortcut ... https://bugzilla.gnome.org/show_bug.cgi?id=673078 --- panels/keyboard/cc-keyboard-manager.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/panels/keyboard/cc-keyboard-manager.c b/panels/keyboard/cc-keyboard-manager.c index e145b91f7..13190ad02 100644 --- a/panels/keyboard/cc-keyboard-manager.c +++ b/panels/keyboard/cc-keyboard-manager.c @@ -105,19 +105,27 @@ static gboolean find_conflict (CcUniquenessData *data, CcKeyboardItem *item) { - CcKeyCombo *combo = item->primary_combo; + GList *l; gboolean is_conflict = FALSE; if (data->orig_item && cc_keyboard_item_equal (data->orig_item, item)) return FALSE; - if (data->new_mask != combo->mask) - return FALSE; + for (l = item->key_combos; l; l = l->next) + { + CcKeyCombo *combo = l->data; - if (data->new_keyval != 0) - is_conflict = data->new_keyval == combo->keyval; - else - is_conflict = combo->keyval == 0 && data->new_keycode == combo->keycode; + if (data->new_mask != combo->mask) + continue; + + if (data->new_keyval != 0) + is_conflict = data->new_keyval == combo->keyval; + else + is_conflict = combo->keyval == 0 && data->new_keycode == combo->keycode; + + if (is_conflict) + break; + } if (is_conflict) data->conflict_item = item;