From 6c636642df21a8f61f55903ba29af0504f41bf09 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Sat, 2 May 2020 20:34:15 +0500 Subject: [PATCH] widget: Pass parent to gtk_widget_consumes_motion() Right now it assumes that the parent is a GtkWindow. This will break when window dragging is handled by another widget. --- gtk/gtkwidget.c | 7 ++++--- gtk/gtkwidgetprivate.h | 5 +++-- gtk/gtkwindow.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 167d9a15ab..d2a821fa3b 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11439,12 +11439,13 @@ gtk_widget_remove_controller (GtkWidget *widget, } gboolean -_gtk_widget_consumes_motion (GtkWidget *widget, - GdkEventSequence *sequence) +gtk_widget_consumes_motion (GtkWidget *widget, + GtkWidget *parent, + GdkEventSequence *sequence) { GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - while (widget != NULL && !GTK_IS_WINDOW (widget)) + while (widget != NULL && widget != parent) { guint i; diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 5a92e75e5d..6d3fadb929 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -281,8 +281,9 @@ void _gtk_widget_update_parent_muxer (GtkWidget *widget GtkActionMuxer * _gtk_widget_get_action_muxer (GtkWidget *widget, gboolean create); -gboolean _gtk_widget_consumes_motion (GtkWidget *widget, - GdkEventSequence *sequence); +gboolean gtk_widget_consumes_motion (GtkWidget *widget, + GtkWidget *parent, + GdkEventSequence *sequence); gboolean gtk_widget_has_tick_callback (GtkWidget *widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index bc79bd3d28..883c1117b5 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1472,7 +1472,7 @@ drag_gesture_update_cb (GtkGestureDrag *gesture, */ if (event_widget != GTK_WIDGET (window) && !gtk_widget_has_grab (event_widget) && - _gtk_widget_consumes_motion (event_widget, sequence)) + gtk_widget_consumes_motion (event_widget, GTK_WIDGET (window), sequence)) { gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED); return;