summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-22 18:25:13 +0000
committerMatthias Clasen <mclasen@redhat.com>2022-06-22 18:25:13 +0000
commit287ed99130a1bfbbcb5f971709244c581a226869 (patch)
treeb56c6941ad7847ce6ef1e32eb892c5fb1d2d3a28
parent40e09cf2bb592c3b541993bc7e324a8e06bdfb61 (diff)
parent18c2ba9b717bdece2e429019d2e6740a45449825 (diff)
downloadgtk+-287ed99130a1bfbbcb5f971709244c581a226869.tar.gz
Merge branch 'wip/otte/inspector-inspector' into 'main'
inspector: Inspect See merge request GNOME/gtk!4822
-rw-r--r--gtk/inspector/object-tree.c3
-rw-r--r--gtk/inspector/visual.c16
-rw-r--r--gtk/inspector/visual.ui27
-rw-r--r--gtk/inspector/window.c21
4 files changed, 49 insertions, 18 deletions
diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c
index 34a7406683..1c5f022925 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -1136,9 +1136,6 @@ toplevel_filter_func (gpointer item,
if (!GTK_IS_WINDOW (item))
return FALSE;
- if (g_str_equal (G_OBJECT_TYPE_NAME (item), "GtkInspectorWindow"))
- return FALSE;
-
return gtk_widget_get_display (item) == display;
}
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 9a2e445354..c3b53bf56d 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -29,6 +29,7 @@
#include "gtkadjustment.h"
#include "gtkbox.h"
+#include "gtkbutton.h"
#include "gtkdropdown.h"
#include "gtkcssproviderprivate.h"
#include "gtkdebug.h"
@@ -1060,14 +1061,24 @@ update_gl_flag (GtkSwitch *sw,
}
static void
-software_gl_activate (GtkSwitch *sw,
- GParamSpec *pspec,
+software_gl_activate (GtkSwitch *sw,
+ GParamSpec *pspec,
GtkInspectorVisual *vis)
{
update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE, vis);
}
static void
+inspect_inspector (GtkButton *button,
+ GtkInspectorVisual *vis)
+{
+ GtkWidget *inspector_window;
+
+ inspector_window = gtk_inspector_window_get (gtk_widget_get_display (GTK_WIDGET (button)));
+ gtk_window_present (GTK_WINDOW (inspector_window));
+}
+
+static void
gtk_inspector_visual_init (GtkInspectorVisual *vis)
{
gtk_widget_init_template (GTK_WIDGET (vis));
@@ -1177,6 +1188,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
gtk_widget_class_bind_template_callback (widget_class, focus_activate);
gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
+ gtk_widget_class_bind_template_callback (widget_class, inspect_inspector);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index a7ce8fed2e..2915a3685d 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -697,6 +697,32 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkFrame" id="inspector_frame">
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkListBox">
+ <property name="selection-mode">none</property>
+ <property name="show-separators">1</property>
+ <style>
+ <class name="rich-list"/>
+ </style>
+ <child>
+ <object class="GtkListBoxRow">
+ <child>
+ <object class="GtkButton">
+ <property name="label" translatable="yes">Inspect Inspector</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="inspect_inspector"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -744,6 +770,7 @@
<widget name="visual_frame"/>
<widget name="debug_frame"/>
<widget name="misc_frame"/>
+ <widget name="inspector_frame"/>
</widgets>
</object>
</interface>
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 35a90302f0..29d079e4c1 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -679,20 +679,16 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
static GdkDisplay *
get_inspector_display (void)
{
- static GdkDisplay *display = NULL;
-
- if (display == NULL)
- {
- const char *name;
+ GdkDisplay *display;
+ const char *name;
- name = g_getenv ("GTK_INSPECTOR_DISPLAY");
- display = gdk_display_open (name);
+ name = g_getenv ("GTK_INSPECTOR_DISPLAY");
+ display = gdk_display_open (name);
- if (display)
- g_debug ("Using display %s for GtkInspector", name);
- else
- g_message ("Failed to open display %s", name);
- }
+ if (display)
+ g_debug ("Using display %s for GtkInspector", name);
+ else
+ g_message ("Failed to open display %s", name);
if (!display)
{
@@ -706,7 +702,6 @@ get_inspector_display (void)
if (display)
{
- const char *name;
GdkDebugFlags flags;
name = g_getenv ("GTK_INSPECTOR_RENDERER");