From 2740f1d2d2e8080369948da9afebcc575069848d Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Wed, 4 Aug 2021 18:31:21 +0200 Subject: [PATCH] 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: --- 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 bd7aab303..d40400305 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; }