[gtk+/xi2: 130/148] GtkScaleButton: Add GdkDevice field to synthesized events.



commit 10b8dd65f489d7c58ba8bd774db871a45cfdde17
Author: Carlos Garnacho <carlos gnome org>
Date:   Mon Nov 30 13:24:57 2009 +0100

    GtkScaleButton: Add GdkDevice field to synthesized events.

 gtk/gtkscalebutton.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 8f9b919..94905bb 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -1113,8 +1113,21 @@ gtk_scale_button_popup (GtkWidget *widget)
 {
   GdkEvent *ev;
 
-  ev = gdk_event_new (GDK_KEY_RELEASE);
-  gtk_scale_popup (widget, ev, GDK_CURRENT_TIME);
+  /* This is a callback for a keybinding signal,
+   * current event should  be the key event that
+   * triggered it.
+   */
+  ev = gtk_get_current_event ();
+
+  if (ev->type != GDK_KEY_PRESS &&
+      ev->type != GDK_KEY_RELEASE)
+    {
+      gdk_event_free (ev);
+      ev = gdk_event_new (GDK_KEY_RELEASE);
+      ev->key.time = GDK_CURRENT_TIME;
+    }
+
+  gtk_scale_popup (widget, ev, ev->key.time);
   gdk_event_free (ev);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]