[gtk/wip/exalm/focus-entries2: 1/8] widget: Pass parent to gtk_widget_consumes_motion()



commit 5faed1ebaa01d77b1686687e0ea7445ff1ae8379
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat May 2 20:34:15 2020 +0500

    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 f52ef856ce..7b4a588413 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11464,12 +11464,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 19861e3ea5..8ac7f67687 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1471,7 +1471,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;


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