From b0344e1fd8d7f0765964d6551a024de22776195a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Nov 2024 15:33:35 -0500 Subject: [PATCH 1/3] surface: Add debug spew for color states Log the preferred color state events we get. --- gdk/wayland/gdksurface-wayland.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 04e3936114..96438c9cf2 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -928,6 +928,10 @@ preferred_changed (GdkWaylandColorSurface *color, { GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (data); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (GDK_SURFACE (self)), EVENTS, + "preferred color state, surface %p color state %s", + self, gdk_color_state_get_name (color_state)); + gdk_surface_set_color_state (GDK_SURFACE (self), color_state); self->color_state_changed = TRUE; From 841bd9c5c21535f60ec22ff230be979780abe34a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Nov 2024 16:09:45 -0500 Subject: [PATCH 2/3] inspector: Avoid a critical --- gtk/inspector/misc-info.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 01ff97a416..8c0d0a60b4 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -183,8 +183,13 @@ update_allocation (GtkWidget *w, char *size_label; GEnumClass *class; GEnumValue *value; + GtkWidget *target; - if (!gtk_widget_compute_bounds (w, gtk_widget_get_parent (w), &bounds)) + target = gtk_widget_get_parent (w); + if (target == NULL) + target = w; + + if (!gtk_widget_compute_bounds (w, target, &bounds)) graphene_rect_init (&bounds, 0, 0, 0, 0); size_label = g_strdup_printf ("%g × %g +%g +%g", From ed2716f9ce011922f255b66a5bd7e1de9f83f62b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Nov 2024 16:58:44 -0500 Subject: [PATCH 3/3] inspector: Put surfaces and renderers in the tree These are otherwise really hard to navigate to, and we already have plenty of non-widget objects in the tree. --- gtk/inspector/object-tree.c | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c index bda662c094..36a87998ca 100644 --- a/gtk/inspector/object-tree.c +++ b/gtk/inspector/object-tree.c @@ -45,6 +45,7 @@ #include "gtklabel.h" #include "gtklistitem.h" #include "gtkpopover.h" +#include "gtknative.h" #include "gtksettings.h" #include "gtksingleselection.h" #include "gtksignallistitemfactory.h" @@ -132,6 +133,37 @@ object_tree_widget_get_children (GObject *object) return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list))); } +static GObject * +object_tree_window_get_parent (GObject *object) +{ + return NULL; +} + +static GListModel * +object_tree_native_get_children (GObject *object) +{ + GtkNative *native = GTK_NATIVE (object); + GListStore *list; + GListModel *sublist; + + list = g_list_store_new (G_TYPE_LIST_MODEL); + + sublist = G_LIST_MODEL (g_list_store_new (G_TYPE_OBJECT)); + + if (gtk_native_get_surface (native)) + g_list_store_append (G_LIST_STORE (sublist), gtk_native_get_surface (native)); + if (gtk_native_get_renderer (native)) + g_list_store_append (G_LIST_STORE (sublist), gtk_native_get_renderer (native)); + g_list_store_append (list, sublist); + g_object_unref (sublist); + + sublist = object_tree_widget_get_children (object); + g_list_store_append (list, sublist); + g_object_unref (sublist); + + return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list))); +} + static GListModel * object_tree_tree_model_sort_get_children (GObject *object) { @@ -518,6 +550,16 @@ static const ObjectTreeClassFuncs object_tree_class_funcs[] = { object_tree_widget_get_parent, object_tree_combo_box_get_children }, + { + gtk_window_get_type, + object_tree_window_get_parent, + object_tree_native_get_children, + }, + { + gtk_popover_get_type, + object_tree_widget_get_parent, + object_tree_native_get_children, + }, { gtk_widget_get_type, object_tree_widget_get_parent,