diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c index ee632067e2..d11bb94c8f 100644 --- a/gtk/inspector/visual.c +++ b/gtk/inspector/visual.c @@ -36,6 +36,9 @@ #include "gtkscale.h" #include "gtkwindow.h" #include "gtklistbox.h" +#include "gskdebugprivate.h" +#include "gskrendererprivate.h" +#include "gtknative.h" #include "fallback-c89.c" @@ -74,6 +77,7 @@ struct _GtkInspectorVisualPrivate GtkWidget *debug_box; GtkWidget *fps_switch; GtkWidget *updates_switch; + GtkWidget *fallback_switch; GtkWidget *baselines_switch; GtkWidget *layout_switch; GtkWidget *resize_switch; @@ -302,6 +306,48 @@ updates_activate (GtkSwitch *sw, 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 baselines_activate (GtkSwitch *sw) { @@ -871,6 +917,11 @@ row_activated (GtkListBox *box, GtkSwitch *sw = GTK_SWITCH (vis->priv->updates_switch); 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))) { 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, fps_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, layout_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, 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, baselines_activate); gtk_widget_class_bind_template_callback (widget_class, layout_activate); diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui index a28d070d11..ead50b6384 100644 --- a/gtk/inspector/visual.ui +++ b/gtk/inspector/visual.ui @@ -425,6 +425,32 @@ + + + + + 10 + 40 + + + Show Fallback Rendering + start + baseline + 0.0 + + + + + end + baseline + 1 + + + + + + + @@ -586,6 +612,7 @@ +