[Xfce4-commits] <libxfce4ui:jeromeg/keyboard-shortcuts> Don't initialize the match context values twice.

Jérôme Guelfucci noreply at xfce.org
Sat Dec 29 15:00:03 CET 2012


Updating branch refs/heads/jeromeg/keyboard-shortcuts
         to a8c6cd3340203a7229746116e294bbf3a0dc713b (commit)
       from f79efc609adea4155683c5d3cf381823f60ce95c (commit)

commit a8c6cd3340203a7229746116e294bbf3a0dc713b
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 dcfc235..a7632fa 100644
--- a/libxfce4kbd-private/xfce-shortcuts-grabber.c
+++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c
@@ -443,17 +443,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