[gtk/kill-register-surface: 6/10] inspector: Stop using gdk_surface_get_user_data



commit b8e0fb3ecb8847b0ad150c1f8a11e0ea139114cb
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 23 16:51:51 2019 -0500

    inspector: Stop using gdk_surface_get_user_data
    
    Use gtk_root_get_for_surface instead.

 gtk/inspector/inspect-button.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 7297db3043..6b28299e8e 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -36,6 +36,7 @@
 #include "gtkgesturemultipress.h"
 #include "gtkeventcontrollermotion.h"
 #include "gtkeventcontrollerkey.h"
+#include "gtkroot.h"
 
 static GtkWidget *
 find_widget_at_pointer (GdkDevice *device)
@@ -46,31 +47,7 @@ find_widget_at_pointer (GdkDevice *device)
   pointer_surface = gdk_device_get_surface_at_position (device, NULL, NULL);
 
   if (pointer_surface)
-    {
-      gpointer widget_ptr;
-
-      gdk_surface_get_user_data (pointer_surface, &widget_ptr);
-      widget = widget_ptr;
-
-      if (!GTK_IS_WINDOW (widget))
-        {
-          while (TRUE)
-            {
-              GdkSurface *parent = gdk_surface_get_parent (pointer_surface);
-
-              if (!parent)
-                break;
-
-              pointer_surface = parent;
-              gdk_surface_get_user_data (pointer_surface, &widget_ptr);
-              widget = widget_ptr;
-
-              if (GTK_IS_WINDOW (widget))
-                break;
-            }
-
-        }
-    }
+    widget = gtk_root_get_for_surface (pointer_surface);
 
   if (widget)
     {


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