[gnome-control-center] keyboard: Consider additional bindings in uniqueness checks



commit dd024ae722d31ab69b3c05a07dbac5e72154b25e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 22 18:40:57 2017 +0200

    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 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-manager.c b/panels/keyboard/cc-keyboard-manager.c
index e145b91..13190ad 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]