[mutter] keybindings: Merge rebuild_binding_index into reload_combos
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keybindings: Merge rebuild_binding_index into reload_combos
- Date: Fri, 9 Jan 2015 01:06:44 +0000 (UTC)
commit a1d8110221dacf90c00620f9b3d9ae22c931fcb6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 8 12:08:51 2015 -0800
keybindings: Merge rebuild_binding_index into reload_combos
The two are always called at the same time.
src/core/keybindings.c | 47 ++++++++++++++---------------------------------
1 files changed, 14 insertions(+), 33 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 2b0ea31..db3f04f 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -508,6 +508,17 @@ devirtualize_modifiers (MetaKeyBindingManager *keys,
}
static void
+index_binding (MetaKeyBindingManager *keys,
+ MetaKeyBinding *binding)
+{
+ guint32 index_key;
+
+ index_key = key_combo_key (&binding->resolved_combo);
+ g_hash_table_replace (keys->key_bindings_index,
+ GINT_TO_POINTER (index_key), binding);
+}
+
+static void
resolve_key_combo (MetaKeyBindingManager *keys,
MetaKeyCombo *combo,
MetaResolvedKeyCombo *resolved_combo)
@@ -529,11 +540,14 @@ binding_reload_combos_foreach (gpointer key,
MetaKeyBinding *binding = value;
resolve_key_combo (keys, &binding->combo, &binding->resolved_combo);
+ index_binding (keys, binding);
}
static void
reload_combos (MetaKeyBindingManager *keys)
{
+ g_hash_table_remove_all (keys->key_bindings_index);
+
determine_keymap_num_levels (keys);
resolve_key_combo (keys,
@@ -546,35 +560,6 @@ reload_combos (MetaKeyBindingManager *keys)
}
static void
-index_binding (MetaKeyBindingManager *keys,
- MetaKeyBinding *binding)
-{
- guint32 index_key;
-
- index_key = key_combo_key (&binding->resolved_combo);
- g_hash_table_replace (keys->key_bindings_index,
- GINT_TO_POINTER (index_key), binding);
-}
-
-static void
-binding_index_foreach (gpointer key,
- gpointer value,
- gpointer data)
-{
- MetaKeyBindingManager *keys = data;
- MetaKeyBinding *binding = value;
-
- index_binding (keys, binding);
-}
-
-static void
-rebuild_binding_index (MetaKeyBindingManager *keys)
-{
- g_hash_table_remove_all (keys->key_bindings_index);
- g_hash_table_foreach (keys->key_bindings, binding_index_foreach, keys);
-}
-
-static void
rebuild_binding_table (MetaKeyBindingManager *keys,
GList *prefs,
GList *grabs)
@@ -903,8 +888,6 @@ on_keymap_changed (MetaBackend *backend,
reload_combos (keys);
- rebuild_binding_index (keys);
-
grab_key_bindings (display);
}
@@ -1124,7 +1107,6 @@ prefs_changed_callback (MetaPreference pref,
rebuild_key_binding_table (keys);
rebuild_special_bindings (keys);
reload_combos (keys);
- rebuild_binding_index (keys);
grab_key_bindings (display);
break;
case META_PREF_MOUSE_BUTTON_MODS:
@@ -4069,7 +4051,6 @@ meta_display_init_keys (MetaDisplay *display)
rebuild_special_bindings (keys);
reload_combos (keys);
- rebuild_binding_index (keys);
update_window_grab_modifiers (keys);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]