summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-12 18:42:00 +0100
committerinfirit <[email protected]>2014-11-12 20:36:49 +0100
commitd817c619c77795b9fd438ff5b3931df6b2d38184 (patch)
treed35193552bb62c51f7c0ca48c0853c5b631fd710
parent1de3cf470353049ee9974bd6d9a437f556931bea (diff)
downloadmarco-d817c619c77795b9fd438ff5b3931df6b2d38184.tar.bz2
marco-d817c619c77795b9fd438ff5b3931df6b2d38184.tar.xz
Unify keymap-reloading code branches
Simplify the keymap loading logic by unifying the different branches; in the reorganization this patch fixes a bug where when we got a MappingKeyboard event we wouldn't update virtual modifiers correctly. Based on a patch by Thomas Thurman <[email protected]> Based on metacity commit: ba2e5f7f541446931299814bafa642d09047f386 From: "Owen W. Taylor" <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=565540
-rw-r--r--src/core/keybindings.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 9bdea53e..81b1c47f 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -506,19 +506,17 @@ void
meta_display_process_mapping_event (MetaDisplay *display,
XEvent *event)
{
+ gboolean keymap_changed = FALSE;
+ gboolean modmap_changed = FALSE;
+
#ifdef HAVE_XKB
if (event->type == display->xkb_base_event_type)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"XKB mapping changed, will redo keybindings\n");
- reload_keymap (display);
- reload_modmap (display);
-
- reload_keycodes (display);
- reload_modifiers (display);
-
- regrab_key_bindings (display);
+ keymap_changed = TRUE;
+ modmap_changed = TRUE;
}
else
#endif
@@ -527,21 +525,33 @@ meta_display_process_mapping_event (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS,
"Received MappingModifier event, will reload modmap and redo keybindings\n");
- reload_modmap (display);
-
- reload_modifiers (display);
-
- regrab_key_bindings (display);
+ modmap_changed = TRUE;
}
else if (event->xmapping.request == MappingKeyboard)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Received MappingKeyboard event, will reload keycodes and redo keybindings\n");
- reload_keymap (display);
+ keymap_changed = TRUE;
+ }
+
+ /* Now to do the work itself */
+
+ if (keymap_changed || modmap_changed)
+ {
+ if (keymap_changed)
+ reload_keymap (display);
+
+ /* Deciphering the modmap depends on the loaded keysyms to find out
+ * what modifiers is Super and so forth, so we need to reload it
+ * even when only the keymap changes */
reload_modmap (display);
- reload_keycodes (display);
+
+ if (keymap_changed)
+ reload_keycodes (display);
+
+ reload_modifiers (display);
regrab_key_bindings (display);
}