[gtk+] cellrendererspin: Update to using GdkEvent API



commit 75492e3cef59191c189b5ee4a45494d3d289d56a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 25 16:44:04 2017 +0200

    cellrendererspin: Update to using GdkEvent API

 gtk/gtkcellrendererspin.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcellrendererspin.c b/gtk/gtkcellrendererspin.c
index c7e9f7c..e9b8435 100644
--- a/gtk/gtkcellrendererspin.c
+++ b/gtk/gtkcellrendererspin.c
@@ -280,14 +280,20 @@ gtk_cell_renderer_spin_key_press_event (GtkWidget   *widget,
                                        GdkEventKey *event,
                                        gpointer     data)
 {
-  if (event->state == 0)
+  guint state, keyval;
+
+  if (!gdk_event_get_state ((GdkEvent *) event, &state) ||
+      !gdk_event_get_keyval ((GdkEvent *) event, &keyval))
+    return GDK_EVENT_PROPAGATE;
+
+  if (state == 0)
     {
-      if (event->keyval == GDK_KEY_Up)
+      if (keyval == GDK_KEY_Up)
        {
          gtk_spin_button_spin (GTK_SPIN_BUTTON (widget), GTK_SPIN_STEP_FORWARD, 1);
          return TRUE;
        }
-      else if (event->keyval == GDK_KEY_Down)
+      else if (keyval == GDK_KEY_Down)
        {
          gtk_spin_button_spin (GTK_SPIN_BUTTON (widget), GTK_SPIN_STEP_BACKWARD, 1);
          return TRUE;
@@ -302,11 +308,13 @@ gtk_cell_renderer_spin_button_press_event (GtkWidget      *widget,
                                            GdkEventButton *event,
                                            gpointer        user_data)
 {
+  GdkEventType event_type = gdk_event_get_event_type ((GdkEvent *) event);
+
   /* Block 2BUTTON and 3BUTTON here, so that they won't be eaten
    * by tree view.
    */
-  if (event->type == GDK_2BUTTON_PRESS
-      || event->type == GDK_3BUTTON_PRESS)
+  if (event_type == GDK_2BUTTON_PRESS
+      || event_type == GDK_3BUTTON_PRESS)
     return TRUE;
 
   return FALSE;


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