[gtk+] places sidebar: Stop using ::motion-notify-event



commit f90659cde8469de23cc47417108759375828695e
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 15 23:34:13 2018 -0500

    places sidebar: Stop using ::motion-notify-event
    
    We can use the generic ::event signal here.

 gtk/gtkplacessidebar.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 053625a..4a09742 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1696,20 +1696,23 @@ stop_drop_feedback (GtkPlacesSidebar *sidebar)
 }
 
 static gboolean
-on_motion_notify_event (GtkWidget      *widget,
-                        GdkEventMotion *event,
-                        gpointer        user_data)
+sidebar_event_cb (GtkWidget *widget,
+                  GdkEvent  *event,
+                  gpointer   user_data)
 {
   GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
   guint state;
   double x, y;
 
+  if (gdk_event_get_event_type (event) != GDK_MOTION_NOTIFY)
+    return GDK_EVENT_PROPAGATE;
+
   if (sidebar->drag_row == NULL || sidebar->dragging_over)
-    return FALSE;
+    return GDK_EVENT_PROPAGATE;
 
-  if (!gdk_event_get_state ((GdkEvent *) event, &state) ||
+  if (!gdk_event_get_state (event, &state) ||
       !(state & GDK_BUTTON1_MASK))
-    return FALSE;
+    return GDK_EVENT_PROPAGATE;
 
   gdk_event_get_coords ((GdkEvent *) event, &x, &y);
 
@@ -1725,7 +1728,7 @@ on_motion_notify_event (GtkWidget      *widget,
                                        sidebar->drag_x, sidebar->drag_y);
     }
 
-  return FALSE;
+  return GDK_EVENT_PROPAGATE;
 }
 
 static void
@@ -4071,8 +4074,8 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
   sidebar->source_targets = gdk_content_formats_new (dnd_source_targets, G_N_ELEMENTS (dnd_source_targets));
   sidebar->source_targets = gtk_content_formats_add_text_targets (sidebar->source_targets);
 
-  g_signal_connect (sidebar->list_box, "motion-notify-event",
-                    G_CALLBACK (on_motion_notify_event), sidebar);
+  g_signal_connect (sidebar->list_box, "event",
+                    G_CALLBACK (sidebar_event_cb), sidebar);
   g_signal_connect (sidebar->list_box, "drag-begin",
                     G_CALLBACK (drag_begin_callback), sidebar);
   g_signal_connect (sidebar->list_box, "drag-motion",


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