diff options
Diffstat (limited to 'gtk/gtkdropcontrollermotion.c')
-rw-r--r-- | gtk/gtkdropcontrollermotion.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gtk/gtkdropcontrollermotion.c b/gtk/gtkdropcontrollermotion.c index 75c816cb74..1510278a02 100644 --- a/gtk/gtkdropcontrollermotion.c +++ b/gtk/gtkdropcontrollermotion.c @@ -77,22 +77,27 @@ static guint signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE (GtkDropControllerMotion, gtk_drop_controller_motion, GTK_TYPE_EVENT_CONTROLLER) +static GtkFilterEventStatus +gtk_drop_controller_motion_filter_event (GtkEventController *controller, + GdkEvent *event) +{ + GdkEventType event_type = gdk_event_get_event_type (event); + + if (event_type == GDK_DRAG_MOTION) + return GTK_EVENT_HANDLE; + + return GTK_EVENT_SKIP; +} + static gboolean gtk_drop_controller_motion_handle_event (GtkEventController *controller, GdkEvent *event, double x, double y) { - GtkEventControllerClass *parent_class; - GdkEventType type; - - type = gdk_event_get_event_type (event); - if (type == GDK_DRAG_MOTION) - g_signal_emit (controller, signals[MOTION], 0, x, y); - - parent_class = GTK_EVENT_CONTROLLER_CLASS (gtk_drop_controller_motion_parent_class); + g_signal_emit (controller, signals[MOTION], 0, x, y); - return parent_class->handle_event (controller, event, x, y); + return GDK_EVENT_PROPAGATE; } static void @@ -204,6 +209,7 @@ gtk_drop_controller_motion_class_init (GtkDropControllerMotionClass *klass) object_class->get_property = gtk_drop_controller_motion_get_property; + controller_class->filter_event = gtk_drop_controller_motion_filter_event; controller_class->handle_event = gtk_drop_controller_motion_handle_event; controller_class->handle_crossing = gtk_drop_controller_motion_handle_crossing; |