[Xfce4-commits] <libxfce4ui:xfce-4.10> Don't initialize the match context values twice.

Jérôme Guelfucci noreply at xfce.org
Sat May 4 12:10:10 CEST 2013


Updating branch refs/heads/xfce-4.10
         to 4dba3925c2103a1320759bc003df68dbc9b0394f (commit)
       from 4561420e4a3fbe33f0e7533b5ae0592b07578695 (commit)

commit 4dba3925c2103a1320759bc003df68dbc9b0394f
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sat Dec 29 14:56:50 2012 +0100

    Don't initialize the match context values twice.
    
    They are initialized to the correct values by the later
    gtk_accelerator_parse call.

 libxfce4kbd-private/xfce-shortcuts-grabber.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c
index 5728dda..f177206 100644
--- a/libxfce4kbd-private/xfce-shortcuts-grabber.c
+++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c
@@ -440,17 +440,20 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
   modifiers &= ~consumed;
   modifiers &= mod_mask;
 
-  context.keyval = keyval;
-  context.modifiers = modifiers;
-
+  /* Use the keyval and modifiers values of gtk_accelerator_parse. We
+   * will compare them with values we also get from this function and as
+   * it has its own logic, it's easier and safer to do so.
+   * See bug #8744 for a "live" example. */
   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);
 
   g_hash_table_foreach (grabber->priv->keys, (GHFunc) find_event_key, &context);
 
   if (G_LIKELY (context.result != NULL))
+    /* We had a positive match */
     g_signal_emit_by_name (grabber, "shortcut-activated",
                            context.result, timestamp);
 


More information about the Xfce4-commits mailing list