ed26f79
commit fe4aff6a20024d9480199e19c13614dd118be725
ed26f79
Author: Harald Judt <h.judt@gmx.at>
ed26f79
Date:   Fri May 4 22:24:12 2012 +0200
ed26f79
ed26f79
    Enable <Shift> as modifier key in shortcuts grabber.
ed26f79
    
ed26f79
    This restores the functionality of <Shift> as a modifier key.
ed26f79
    Using <Shift_L> and <Shift_R> as a single key is still possible.
ed26f79
    
ed26f79
    It seems gtk_accelerator_name is not designed to distinguish between
ed26f79
    upper-/lowercase, so we just store the <Shift> key in the accelerator
ed26f79
    name. This might not be the recommended way to store accelerators
ed26f79
    as specified by the GTK docs, but at least it fixes the regression
ed26f79
    and seems to not cause any troubles.
ed26f79
    
ed26f79
    Additionally, we need to gtk_accelerator_parse the value returned by
ed26f79
    gtk_accelerator_name, because the key values of both functions are
ed26f79
    not consistent.
ed26f79
ed26f79
diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c
ed26f79
index 9faec07..01b85c3 100644
ed26f79
--- a/libxfce4kbd-private/xfce-shortcuts-grabber.c
ed26f79
+++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c
ed26f79
@@ -512,8 +512,10 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
ed26f79
                                        &keyval, NULL, NULL, &consumed);
ed26f79
 
ed26f79
   /* Get the modifiers */
ed26f79
-  modifiers &= ~consumed;
ed26f79
+  if ((modifiers & GDK_SHIFT_MASK) && (consumed & GDK_SHIFT_MASK))
ed26f79
+    consumed &= ~GDK_SHIFT_MASK;
ed26f79
   gdk_keymap_add_virtual_modifiers (keymap, &modifiers);
ed26f79
+  modifiers &= ~consumed;
ed26f79
   modifiers &= mod_mask;
ed26f79
 
ed26f79
   context.keyval = keyval;
ed26f79
@@ -521,6 +523,7 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
ed26f79
 
ed26f79
   raw_shortcut_name = gtk_accelerator_name (keyval, modifiers);
ed26f79
   TRACE ("Looking for %s", raw_shortcut_name);
ed26f79
+  gtk_accelerator_parse (raw_shortcut_name, &context.keyval, &context.modifiers);
ed26f79
   g_free (raw_shortcut_name);
ed26f79
 
ed26f79
   g_hash_table_foreach (grabber->priv->keys, (GHFunc) find_event_key, &context);