[mutter] keymap/x11: Stop searching through reserved keycodes explicitly



commit 2740f1d2d2e8080369948da9afebcc575069848d
Author: Sebastian Keller <skeller gnome org>
Date:   Wed Aug 4 18:31:21 2021 +0200

    keymap/x11: Stop searching through reserved keycodes explicitly
    
    Keys in the reserved keycode list are always added for the first group.
    Before the previous commit such keycodes were not found unless that was
    the current group. But now that we can also find matching keycodes that
    are not directly in the current group, this is not necessary anymore.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1955>

 src/backends/x11/meta-keymap-x11.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/src/backends/x11/meta-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c
index bd7aab3036..d404003057 100644
--- a/src/backends/x11/meta-keymap-x11.c
+++ b/src/backends/x11/meta-keymap-x11.c
@@ -922,7 +922,6 @@ meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
 {
   ClutterKeymapKey key;
   int group;
-  gboolean found = FALSE;
 
   g_return_val_if_fail (keycode_out != NULL, FALSE);
   g_return_val_if_fail (level_out != NULL, FALSE);
@@ -933,27 +932,8 @@ meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
     {
       *keycode_out = key.keycode;
       *level_out = key.level;
-      found = TRUE;
-    }
-  else
-    {
-      GHashTableIter iter;
-      gpointer key, value;
-
-      g_hash_table_iter_init (&iter, keymap_x11->reserved_keycodes);
-      while (!found && g_hash_table_iter_next (&iter, &key, &value))
-        {
-          uint32_t reserved_keycode = GPOINTER_TO_UINT (key);
-          uint32_t reserved_keysym = GPOINTER_TO_UINT (value);
-
-          if (keyval == reserved_keysym)
-            {
-              *keycode_out = reserved_keycode;
-              *level_out = 0;
-              found = TRUE;
-            }
-        }
+      return TRUE;
     }
 
-  return found;
+  return FALSE;
 }


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