Updating branch refs/heads/xfce-4.10 to 9b7bd5473a0057deeaba8016c8497a9cdc0fd53b (commit) from 9acd5517605cddfa3484b83b8fb119d9c8a032a5 (commit)
commit 9b7bd5473a0057deeaba8016c8497a9cdc0fd53b Author: Harald Judt <h.j...@gmx.at> Date: Tue Dec 18 09:00:44 2012 +0100 Fix keyboard shortcuts with Shift modifier (bug #8744). libxfce4kbd-private/xfce-shortcut-dialog.c | 8 ++++++++ libxfce4kbd-private/xfce-shortcuts-grabber.c | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c index b637840..feb7a21 100644 --- a/libxfce4kbd-private/xfce-shortcut-dialog.c +++ b/libxfce4kbd-private/xfce-shortcut-dialog.c @@ -327,6 +327,14 @@ xfce_shortcut_dialog_key_pressed (XfceShortcutDialog *dialog, &keyval, NULL, NULL, &consumed); /* Get the modifiers */ + + /* If Shift was used when translating the keyboard state, we remove it + * from the consumed bit because gtk_accelerator_{name,parse} fail to + * handle this correctly. This allows us to have shortcuts with Shift + * as a modifier key (see bug #8744). */ + if ((modifiers & GDK_SHIFT_MASK) && (consumed & GDK_SHIFT_MASK)) + consumed &= ~GDK_SHIFT_MASK; + modifiers &= ~consumed; modifiers &= mod_mask; diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c index 120cc03..a5801d3 100644 --- a/libxfce4kbd-private/xfce-shortcuts-grabber.c +++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c @@ -313,7 +313,7 @@ xfce_shortcuts_grabber_grab (XfceShortcutsGrabber *grabber, TRACE ("Ungrabbing %s", shortcut_name); TRACE ("Keyval: %d", key->keyval); - TRACE ("Modifiers: 0x%x", key->modifiers); + TRACE ("Modifiers: 0x%x", modifiers); g_free (shortcut_name); @@ -495,6 +495,15 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent *gdk_xevent, XkbGroupForCoreState (xevent->xkey.state), &keyval, NULL, NULL, &consumed); + /* Get the modifiers */ + + /* If Shift was used when translating the keyboard state, we remove it + * from the consumed bit because gtk_accelerator_{name,parse} fail to + * handle this correctly. This allows us to have shortcuts with Shift + * as a modifier key (see bug #8744). */ + if ((modifiers & GDK_SHIFT_MASK) && (consumed & GDK_SHIFT_MASK)) + consumed &= ~GDK_SHIFT_MASK; + modifiers &= ~consumed; modifiers &= mod_mask; @@ -503,6 +512,7 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent *gdk_xevent, context.consumed = consumed; raw_shortcut_name = gtk_accelerator_name (keyval, modifiers); + gtk_accelerator_parse (raw_shortcut_name, &context.keyval, &context.modifiers); TRACE ("Looking for %s", raw_shortcut_name); g_free (raw_shortcut_name); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits