forked from AuroraMiddleware/gtk
inspector: Add a switch for fallback rendering
This commit is contained in:
parent
d4c97ea2b4
commit
745a701b3d
@ -36,6 +36,9 @@
|
|||||||
#include "gtkscale.h"
|
#include "gtkscale.h"
|
||||||
#include "gtkwindow.h"
|
#include "gtkwindow.h"
|
||||||
#include "gtklistbox.h"
|
#include "gtklistbox.h"
|
||||||
|
#include "gskdebugprivate.h"
|
||||||
|
#include "gskrendererprivate.h"
|
||||||
|
#include "gtknative.h"
|
||||||
|
|
||||||
#include "fallback-c89.c"
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
@ -74,6 +77,7 @@ struct _GtkInspectorVisualPrivate
|
|||||||
GtkWidget *debug_box;
|
GtkWidget *debug_box;
|
||||||
GtkWidget *fps_switch;
|
GtkWidget *fps_switch;
|
||||||
GtkWidget *updates_switch;
|
GtkWidget *updates_switch;
|
||||||
|
GtkWidget *fallback_switch;
|
||||||
GtkWidget *baselines_switch;
|
GtkWidget *baselines_switch;
|
||||||
GtkWidget *layout_switch;
|
GtkWidget *layout_switch;
|
||||||
GtkWidget *resize_switch;
|
GtkWidget *resize_switch;
|
||||||
@ -302,6 +306,48 @@ updates_activate (GtkSwitch *sw,
|
|||||||
redraw_everything ();
|
redraw_everything ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fallback_activate (GtkSwitch *sw,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
GtkInspectorVisual *vis)
|
||||||
|
{
|
||||||
|
GtkInspectorWindow *iw;
|
||||||
|
gboolean fallback;
|
||||||
|
guint flags;
|
||||||
|
GList *toplevels, *l;
|
||||||
|
|
||||||
|
fallback = gtk_switch_get_active (sw);
|
||||||
|
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis)));
|
||||||
|
if (iw == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
flags = gsk_get_debug_flags ();
|
||||||
|
if (fallback)
|
||||||
|
flags = flags | GSK_DEBUG_FALLBACK;
|
||||||
|
else
|
||||||
|
flags = flags & ~GSK_DEBUG_FALLBACK;
|
||||||
|
gsk_set_debug_flags (flags);
|
||||||
|
|
||||||
|
toplevels = gtk_window_list_toplevels ();
|
||||||
|
for (l = toplevels; l; l = l->next)
|
||||||
|
{
|
||||||
|
GtkWidget *toplevel = l->data;
|
||||||
|
GskRenderer *renderer;
|
||||||
|
|
||||||
|
if ((GtkRoot *)toplevel == gtk_widget_get_root (GTK_WIDGET (sw))) /* skip the inspector */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
renderer = gtk_native_get_renderer (GTK_NATIVE (toplevel));
|
||||||
|
if (!renderer)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
gsk_renderer_set_debug_flags (renderer, flags);
|
||||||
|
}
|
||||||
|
g_list_free (toplevels);
|
||||||
|
|
||||||
|
redraw_everything ();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
baselines_activate (GtkSwitch *sw)
|
baselines_activate (GtkSwitch *sw)
|
||||||
{
|
{
|
||||||
@ -871,6 +917,11 @@ row_activated (GtkListBox *box,
|
|||||||
GtkSwitch *sw = GTK_SWITCH (vis->priv->updates_switch);
|
GtkSwitch *sw = GTK_SWITCH (vis->priv->updates_switch);
|
||||||
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
|
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
|
||||||
}
|
}
|
||||||
|
else if (gtk_widget_is_ancestor (vis->priv->fallback_switch, GTK_WIDGET (row)))
|
||||||
|
{
|
||||||
|
GtkSwitch *sw = GTK_SWITCH (vis->priv->fallback_switch);
|
||||||
|
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
|
||||||
|
}
|
||||||
else if (gtk_widget_is_ancestor (vis->priv->baselines_switch, GTK_WIDGET (row)))
|
else if (gtk_widget_is_ancestor (vis->priv->baselines_switch, GTK_WIDGET (row)))
|
||||||
{
|
{
|
||||||
GtkSwitch *sw = GTK_SWITCH (vis->priv->baselines_switch);
|
GtkSwitch *sw = GTK_SWITCH (vis->priv->baselines_switch);
|
||||||
@ -1058,12 +1109,14 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
|
|||||||
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);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fps_switch);
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fps_switch);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, updates_switch);
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, updates_switch);
|
||||||
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fallback_switch);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
|
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, layout_switch);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, resize_switch);
|
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, resize_switch);
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, fps_activate);
|
gtk_widget_class_bind_template_callback (widget_class, fps_activate);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
|
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, fallback_activate);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
|
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
|
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
|
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
|
||||||
|
@ -425,6 +425,32 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBoxRow">
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="margin">10</property>
|
||||||
|
<property name="spacing">40</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="fallback_label">
|
||||||
|
<property name="label" translatable="yes">Show Fallback Rendering</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="xalign">0.0</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="fallback_switch">
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<signal name="notify::active" handler="fallback_activate"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBoxRow">
|
<object class="GtkListBoxRow">
|
||||||
<child>
|
<child>
|
||||||
@ -586,6 +612,7 @@
|
|||||||
<widget name="hidpi_label"/>
|
<widget name="hidpi_label"/>
|
||||||
<widget name="animation_label"/>
|
<widget name="animation_label"/>
|
||||||
<widget name="updates_label"/>
|
<widget name="updates_label"/>
|
||||||
|
<widget name="fallback_label"/>
|
||||||
<widget name="baselines_label"/>
|
<widget name="baselines_label"/>
|
||||||
<widget name="layout_label"/>
|
<widget name="layout_label"/>
|
||||||
<widget name="resize_label"/>
|
<widget name="resize_label"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user