inspector: Rearrange settings a bit

Keep only the software gl setting for GL, and put it together
with the simulate touchscreen setting in a 'misc' box. This
keeps all the 'show' options nicely grouped.
This commit is contained in:
Matthias Clasen 2019-04-06 17:39:00 +00:00
parent c31185b419
commit c92e53622f
2 changed files with 41 additions and 112 deletions

View File

@ -35,6 +35,7 @@
#include "gtkswitch.h" #include "gtkswitch.h"
#include "gtkscale.h" #include "gtkscale.h"
#include "gtkwindow.h" #include "gtkwindow.h"
#include "gtklistbox.h"
#include "fallback-c89.c" #include "fallback-c89.c"
@ -69,14 +70,10 @@ struct _GtkInspectorVisualPrivate
GtkAdjustment *cursor_size_adjustment; GtkAdjustment *cursor_size_adjustment;
GtkWidget *debug_box; GtkWidget *debug_box;
GtkWidget *baselines_switch;
GtkWidget *layout_switch;
GtkWidget *touchscreen_switch;
GtkWidget *gl_box; GtkWidget *misc_box;
GtkWidget *gl_combo; GtkWidget *touchscreen_switch;
GtkWidget *software_gl_switch; GtkWidget *software_gl_switch;
GtkWidget *texture_rectangle_switch;
GtkAdjustment *focus_adjustment; GtkAdjustment *focus_adjustment;
@ -461,9 +458,12 @@ init_theme (GtkInspectorVisual *vis)
if (g_getenv ("GTK_THEME") != NULL) if (g_getenv ("GTK_THEME") != NULL)
{ {
GtkWidget *row;
/* theme is hardcoded, nothing we can do */ /* theme is hardcoded, nothing we can do */
gtk_widget_set_sensitive (vis->priv->theme_combo, FALSE); gtk_widget_set_sensitive (vis->priv->theme_combo, FALSE);
gtk_widget_set_tooltip_text (vis->priv->theme_combo , _("Theme is hardcoded by GTK_THEME")); row = gtk_widget_get_ancestor (vis->priv->theme_combo, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_set_tooltip_text (row, _("Theme is hardcoded by GTK_THEME"));
} }
} }
@ -476,9 +476,12 @@ init_dark (GtkInspectorVisual *vis)
if (g_getenv ("GTK_THEME") != NULL) if (g_getenv ("GTK_THEME") != NULL)
{ {
GtkWidget *row;
/* theme is hardcoded, nothing we can do */ /* theme is hardcoded, nothing we can do */
gtk_widget_set_sensitive (vis->priv->dark_switch, FALSE); gtk_widget_set_sensitive (vis->priv->dark_switch, FALSE);
gtk_widget_set_tooltip_text (vis->priv->dark_switch, _("Theme is hardcoded by GTK_THEME")); row = gtk_widget_get_ancestor (vis->priv->theme_combo, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_set_tooltip_text (row, _("Theme is hardcoded by GTK_THEME"));
} }
} }
@ -683,10 +686,12 @@ init_scale (GtkInspectorVisual *vis)
else else
#endif #endif
{ {
GtkWidget *row;
gtk_adjustment_set_value (vis->priv->scale_adjustment, 1); gtk_adjustment_set_value (vis->priv->scale_adjustment, 1);
gtk_widget_set_sensitive (vis->priv->hidpi_spin, FALSE); gtk_widget_set_sensitive (vis->priv->hidpi_spin, FALSE);
gtk_widget_set_tooltip_text (vis->priv->hidpi_spin, row = gtk_widget_get_ancestor (vis->priv->hidpi_spin, GTK_TYPE_LIST_BOX_ROW);
_("Backend does not support window scaling")); gtk_widget_set_tooltip_text (row, _("Backend does not support window scaling"));
} }
} }
@ -778,10 +783,13 @@ init_touchscreen (GtkInspectorVisual *vis)
if (g_getenv ("GTK_TEST_TOUCHSCREEN") != 0) if (g_getenv ("GTK_TEST_TOUCHSCREEN") != 0)
{ {
GtkWidget *row;
/* hardcoded, nothing we can do */ /* hardcoded, nothing we can do */
gtk_switch_set_active (GTK_SWITCH (vis->priv->touchscreen_switch), TRUE); gtk_switch_set_active (GTK_SWITCH (vis->priv->touchscreen_switch), TRUE);
gtk_widget_set_sensitive (vis->priv->touchscreen_switch, FALSE); gtk_widget_set_sensitive (vis->priv->touchscreen_switch, FALSE);
gtk_widget_set_tooltip_text (vis->priv->touchscreen_switch, _("Setting is hardcoded by GTK_TEST_TOUCHSCREEN")); row = gtk_widget_get_ancestor (vis->priv->touchscreen_switch, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_set_tooltip_text (row, _("Setting is hardcoded by GTK_TEST_TOUCHSCREEN"));
} }
} }
@ -796,12 +804,12 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
next = vis->priv->debug_box; next = vis->priv->debug_box;
else if (direction == GTK_DIR_DOWN && else if (direction == GTK_DIR_DOWN &&
widget == vis->priv->debug_box) widget == vis->priv->debug_box)
next = vis->priv->gl_box; next = vis->priv->misc_box;
else if (direction == GTK_DIR_UP && else if (direction == GTK_DIR_UP &&
widget == vis->priv->debug_box) widget == vis->priv->debug_box)
next = vis->priv->visual_box; next = vis->priv->visual_box;
else if (direction == GTK_DIR_UP && else if (direction == GTK_DIR_UP &&
widget == vis->priv->gl_box) widget == vis->priv->misc_box)
next = vis->priv->debug_box; next = vis->priv->debug_box;
else else
next = NULL; next = NULL;
@ -836,23 +844,15 @@ init_gl (GtkInspectorVisual *vis)
{ {
GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ()); GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
if (flags & GDK_DEBUG_GL_DISABLE)
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "disable");
else
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "maybe");
gtk_widget_set_sensitive (vis->priv->gl_combo, FALSE);
gtk_widget_set_tooltip_text (vis->priv->gl_combo,
_("Not settable at runtime.\nUse GDK_DEBUG=gl-disable instead"));
gtk_switch_set_active (GTK_SWITCH (vis->priv->software_gl_switch), flags & GDK_DEBUG_GL_SOFTWARE); gtk_switch_set_active (GTK_SWITCH (vis->priv->software_gl_switch), flags & GDK_DEBUG_GL_SOFTWARE);
gtk_switch_set_active (GTK_SWITCH (vis->priv->texture_rectangle_switch), flags & GDK_DEBUG_GL_TEXTURE_RECT);
if (flags & GDK_DEBUG_GL_DISABLE) if (flags & GDK_DEBUG_GL_DISABLE)
{ {
GtkWidget *row;
gtk_widget_set_sensitive (vis->priv->software_gl_switch, FALSE); gtk_widget_set_sensitive (vis->priv->software_gl_switch, FALSE);
gtk_widget_set_sensitive (vis->priv->texture_rectangle_switch, FALSE); row = gtk_widget_get_ancestor (vis->priv->software_gl_switch, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_set_tooltip_text (vis->priv->software_gl_switch, _("GL rendering is disabled")); gtk_widget_set_tooltip_text (row, _("GL rendering is disabled"));
gtk_widget_set_tooltip_text (vis->priv->texture_rectangle_switch, _("GL rendering is disabled"));
} }
} }
@ -876,12 +876,6 @@ software_gl_activate (GtkSwitch *sw)
update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE); update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE);
} }
static void
texture_rectangle_activate (GtkSwitch *sw)
{
update_gl_flag (sw, GDK_DEBUG_GL_TEXTURE_RECT);
}
static void static void
gtk_inspector_visual_init (GtkInspectorVisual *vis) gtk_inspector_visual_init (GtkInspectorVisual *vis)
{ {
@ -915,7 +909,7 @@ gtk_inspector_visual_constructed (GObject *object)
g_signal_connect (vis->priv->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis); g_signal_connect (vis->priv->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
g_signal_connect (vis->priv->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis); g_signal_connect (vis->priv->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
g_signal_connect (vis->priv->gl_box, "keynav-failed", G_CALLBACK (keynav_failed), vis); g_signal_connect (vis->priv->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
} }
static void static void
@ -945,8 +939,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, layout_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, theme_combo); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, theme_combo);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, dark_switch); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, dark_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, cursor_combo); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, cursor_combo);
@ -962,10 +954,8 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, visual_box); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, visual_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, debug_box); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, debug_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_button); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, gl_box); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, misc_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, gl_combo);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, software_gl_switch); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, software_gl_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, texture_rectangle_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_entry); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_adjustment); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_adjustment);
@ -976,7 +966,6 @@ 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, layout_activate);
gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate); gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate);
gtk_widget_class_bind_template_callback (widget_class, software_gl_activate); gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
gtk_widget_class_bind_template_callback (widget_class, texture_rectangle_activate);
} }
// vim: set et sw=2 ts=2: // vim: set et sw=2 ts=2:

View File

@ -414,7 +414,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="updates_switch"> <object class="GtkSwitch">
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">baseline</property> <property name="valign">baseline</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
@ -441,7 +441,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="baselines_switch"> <object class="GtkSwitch">
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">baseline</property> <property name="valign">baseline</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
@ -468,7 +468,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSwitch" id="layout_switch"> <object class="GtkSwitch">
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">baseline</property> <property name="valign">baseline</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
@ -506,6 +506,16 @@
</child> </child>
</object> </object>
</child> </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="misc_frame">
<property name="halign">center</property>
<child>
<object class="GtkListBox" id="misc_box">
<property name="selection-mode">none</property>
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow">
<property name="activatable">0</property> <property name="activatable">0</property>
@ -532,46 +542,6 @@
</child> </child>
</object> </object>
</child> </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="gl_frame">
<property name="halign">center</property>
<child>
<object class="GtkListBox" id="gl_box">
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="margin">10</property>
<property name="spacing">40</property>
<child>
<object class="GtkLabel" id="gl_label">
<property name="label" translatable="yes">GL Rendering</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0.0</property>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="gl_combo">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="hexpand">1</property>
<items>
<item translatable="yes" id="maybe">When Needed</item>
<item translatable="yes" id="disable">Disabled</item>
</items>
</object>
</child>
</object>
</child>
</object>
</child>
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow">
<property name="activatable">0</property> <property name="activatable">0</property>
@ -599,33 +569,6 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="margin">10</property>
<property name="spacing">40</property>
<child>
<object class="GtkLabel" id="texture_rectangle_label">
<property name="label" translatable="yes">Texture Rectangle Extension</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0.0</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="texture_rectangle_switch">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="hexpand">1</property>
<signal name="notify::active" handler="texture_rectangle_activate"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -648,9 +591,7 @@
<widget name="baselines_label"/> <widget name="baselines_label"/>
<widget name="layout_label"/> <widget name="layout_label"/>
<widget name="touchscreen_label"/> <widget name="touchscreen_label"/>
<widget name="gl_label"/>
<widget name="software_gl_label"/> <widget name="software_gl_label"/>
<widget name="texture_rectangle_label"/>
</widgets> </widgets>
</object> </object>
<object class="GtkSizeGroup"> <object class="GtkSizeGroup">
@ -660,14 +601,13 @@
<widget name="cursor_combo"/> <widget name="cursor_combo"/>
<widget name="font_button"/> <widget name="font_button"/>
<widget name="direction_combo"/> <widget name="direction_combo"/>
<widget name="gl_combo"/>
</widgets> </widgets>
</object> </object>
<object class="GtkSizeGroup"> <object class="GtkSizeGroup">
<widgets> <widgets>
<widget name="visual_frame"/> <widget name="visual_frame"/>
<widget name="debug_frame"/> <widget name="debug_frame"/>
<widget name="gl_frame"/> <widget name="misc_frame"/>
</widgets> </widgets>
</object> </object>
</interface> </interface>