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.
This commit is contained in:
Alexander Mikhaylenko 2020-05-02 20:34:15 +05:00
parent 42ca760f9c
commit 6c636642df
3 changed files with 8 additions and 6 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;