[gtk/pick-insensitive2: 5/9] window: Stop implementing pick



commit 5e2445476461d243d6cfa865d754c1b599878528
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 7 16:11:20 2019 +0000

    window: Stop implementing pick
    
    Treat popovers as a special-case for now.

 gtk/gtkwidget.c        |  9 +++++++++
 gtk/gtkwindow.c        | 14 ++++++--------
 gtk/gtkwindowprivate.h |  3 +++
 3 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2e6602c0ce..694217fadf 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11106,6 +11106,15 @@ gtk_widget_pick (GtkWidget *widget,
       break;
     }
 
+  if (GTK_IS_WINDOW (widget))
+    {
+      GtkWidget *picked;
+
+      picked = gtk_window_pick_popover (GTK_WINDOW (widget), x, y);
+      if (picked)
+        return picked;
+    }
+
   return GTK_WIDGET_GET_CLASS (widget)->pick (widget, x, y);
 }
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 650eac6c3b..ab7dc0419a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -735,12 +735,11 @@ static void popover_get_rect (GtkWindowPopover      *popover,
                               GtkWindow             *window,
                               cairo_rectangle_int_t *rect);
 
-static GtkWidget *
-gtk_window_pick (GtkWidget *widget,
-                 gdouble    x,
-                 gdouble    y)
+GtkWidget *
+gtk_window_pick_popover (GtkWindow *window,
+                         double     x,
+                         double     y)
 {
-  GtkWindow *window = GTK_WINDOW (widget);
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
   GList *popovers;
 
@@ -750,7 +749,7 @@ gtk_window_pick (GtkWidget *widget,
       int dest_x, dest_y;
       GtkWidget *picked;
 
-      gtk_widget_translate_coordinates (widget, popover->widget,
+      gtk_widget_translate_coordinates (GTK_WIDGET (window), popover->widget,
                                         x, y,
                                         &dest_x, &dest_y);
 
@@ -759,7 +758,7 @@ gtk_window_pick (GtkWidget *widget,
         return picked;
     }
 
-  return GTK_WIDGET_CLASS (gtk_window_parent_class)->pick (widget, x, y);
+  return NULL;
 }
 
 static void
@@ -801,7 +800,6 @@ gtk_window_class_init (GtkWindowClass *klass)
   widget_class->state_flags_changed = gtk_window_state_flags_changed;
   widget_class->style_updated = gtk_window_style_updated;
   widget_class->snapshot = gtk_window_snapshot;
-  widget_class->pick = gtk_window_pick;
 
   container_class->add = gtk_window_add;
   container_class->remove = gtk_window_remove;
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index de0c853f77..67e3973c10 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -162,6 +162,9 @@ void             gtk_window_maybe_revoke_implicit_grab (GtkWindow *window,
 void             gtk_window_maybe_update_cursor (GtkWindow *window,
                                                  GtkWidget *widget,
                                                  GdkDevice *device);
+GtkWidget *      gtk_window_pick_popover (GtkWindow *window,
+                                          double     x,
+                                          double     y);
 
 G_END_DECLS
 


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