inspector: Clean up the general tab

Put the Wayland protocols, GL and Vulkan extensions behind expanders,
so we have less scrolling surface by default.
This commit is contained in:
Matthias Clasen 2024-01-06 09:01:01 -05:00
parent 3f513f3cc7
commit 282d66a604
2 changed files with 106 additions and 11 deletions

View File

@ -83,9 +83,15 @@ struct _GtkInspectorGeneral
GtkWidget *version_box;
GtkWidget *env_box;
GtkWidget *display_box;
GtkWidget *display_extensions_row;
GtkWidget *display_extensions_box;
GtkWidget *monitor_box;
GtkWidget *gl_box;
GtkWidget *gl_extensions_row;
GtkWidget *gl_extensions_box;
GtkWidget *vulkan_box;
GtkWidget *vulkan_extensions_row;
GtkWidget *vulkan_extensions_box;
GtkWidget *device_box;
GtkWidget *gtk_version;
GtkWidget *gdk_backend;
@ -290,7 +296,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
Display *dpy,
const char *ext)
{
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
add_check_row (gen, GTK_LIST_BOX (gen->gl_extensions_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
}
#endif
@ -301,7 +307,7 @@ append_wgl_extension_row (GtkInspectorGeneral *gen,
{
HDC hdc = 0;
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_wgl_extension (hdc, ext), 0);
add_check_row (gen, GTK_LIST_BOX (gen->gl_extensions_box), ext, epoxy_has_wgl_extension (hdc, ext), 0);
}
#endif
@ -311,7 +317,7 @@ append_egl_extension_row (GtkInspectorGeneral *gen,
EGLDisplay dpy,
const char *ext)
{
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
add_check_row (gen, GTK_LIST_BOX (gen->gl_extensions_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
}
static EGLDisplay
@ -354,6 +360,7 @@ init_gl (GtkInspectorGeneral *gen)
gtk_widget_set_visible (gen->gl_vendor_row, FALSE);
gtk_widget_set_visible (gen->gl_full_version_row, FALSE);
gtk_widget_set_visible (gen->glsl_version_row, FALSE);
gtk_widget_set_visible (gen->gl_extensions_row, FALSE);
gtk_label_set_text (GTK_LABEL (gen->gl_error), error->message);
g_error_free (error);
return;
@ -527,18 +534,18 @@ init_vulkan (GtkInspectorGeneral *gen)
g_free (api_version);
g_free (driver_version);
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), VK_KHR_SURFACE_EXTENSION_NAME, TRUE, 0);
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_extensions_box), VK_KHR_SURFACE_EXTENSION_NAME, TRUE, 0);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gen->display))
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_KHR_xlib_surface", TRUE, 0);
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_extensions_box), "VK_KHR_xlib_surface", TRUE, 0);
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gen->display))
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_KHR_wayland_surface", TRUE, 0);
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_extensions_box), "VK_KHR_wayland_surface", TRUE, 0);
#endif
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_extensions_box), VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
has_debug_extension (context), 0);
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_LAYER_KHRONOS_validation",
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_extensions_box), "VK_LAYER_KHRONOS_validation",
has_validation_layer (context), 0);
g_object_unref (context);
@ -625,7 +632,7 @@ append_wayland_protocol_row (GtkInspectorGeneral *gen,
if (proxy == NULL)
return;
list = GTK_LIST_BOX (gen->display_box);
list = GTK_LIST_BOX (gen->display_extensions_box);
id = wl_proxy_get_class (proxy);
version = wl_proxy_get_version (proxy);
@ -675,7 +682,6 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
GtkWidget *child;
GtkListBox *list;
gtk_widget_set_visible (gen->display_composited, TRUE);
list = GTK_LIST_BOX (gen->display_box);
children = NULL;
for (child = gtk_widget_get_first_child (GTK_WIDGET (list));
@ -690,7 +696,8 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
child = l->data;
if (gtk_widget_is_ancestor (gen->display_name, child) ||
gtk_widget_is_ancestor (gen->display_rgba, child) ||
gtk_widget_is_ancestor (gen->display_composited, child))
gtk_widget_is_ancestor (gen->display_composited, child) ||
child == gen->display_extensions_row)
continue;
gtk_list_box_remove (list, child);
@ -704,9 +711,16 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
gtk_widget_set_visible (gen->display_composited,
gdk_display_is_composited (display));
list = GTK_LIST_BOX (gen->display_extensions_box);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (list))) != NULL)
gtk_list_box_remove (list, child);
#ifdef GDK_WINDOWING_WAYLAND
add_wayland_protocols (display, gen);
#endif
gtk_widget_set_visible (gen->display_extensions_row,
gtk_widget_get_first_child (gen->display_extensions_box) != NULL);
}
static void
@ -1206,9 +1220,15 @@ gtk_inspector_general_class_init (GtkInspectorGeneralClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, version_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, env_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_extensions_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_extensions_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, monitor_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_extensions_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_extensions_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vulkan_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vulkan_extensions_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vulkan_extensions_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gtk_version);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gdk_backend);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gsk_renderer);

View File

@ -528,6 +528,31 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="display_extensions_row">
<property name="activatable">0</property>
<child>
<object class="GtkExpander">
<property name="label-widget">
<object class="GtkLabel">
<property name="label" translatable="yes">Protocols</property>
<property name="margin-start">10</property>
</object>
</property>
<child>
<object class="GtkListBox" id="display_extensions_box">
<property name="margin-top">20</property>
<property name="selection-mode">none</property>
<property name="halign">center</property>
<style>
<class name="rich-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
@ -768,6 +793,31 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="gl_extensions_row">
<property name="activatable">0</property>
<child>
<object class="GtkExpander">
<property name="label-widget">
<object class="GtkLabel">
<property name="label" translatable="yes">Extensions</property>
<property name="margin-start">10</property>
</object>
</property>
<child>
<object class="GtkListBox" id="gl_extensions_box">
<property name="margin-top">20</property>
<property name="selection-mode">none</property>
<property name="halign">center</property>
<style>
<class name="rich-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
@ -859,6 +909,31 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="vulkan_extensions_row">
<property name="activatable">0</property>
<child>
<object class="GtkExpander">
<property name="label-widget">
<object class="GtkLabel">
<property name="label" translatable="yes">Extensions</property>
<property name="margin-start">10</property>
</object>
</property>
<child>
<object class="GtkListBox" id="vulkan_extensions_box">
<property name="margin-top">20</property>
<property name="selection-mode">none</property>
<property name="halign">center</property>
<style>
<class name="rich-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>