Record node names for debug output

This is useful for GSK_NOTE output as well.
This commit is contained in:
Matthias Clasen 2017-09-03 11:29:29 -04:00
parent 8db13c3362
commit a05895e029
2 changed files with 11 additions and 1 deletions

View File

@ -17,6 +17,8 @@ typedef enum {
GSK_DEBUG_FALLBACK = 1 << 8 GSK_DEBUG_FALLBACK = 1 << 8
} GskDebugFlags; } GskDebugFlags;
#define GSK_DEBUG_ANY ((1 << 9) - 1)
typedef enum { typedef enum {
GSK_RENDERING_MODE_GEOMETRY = 1 << 0, GSK_RENDERING_MODE_GEOMETRY = 1 << 0,
GSK_RENDERING_MODE_SHADERS = 1 << 1, GSK_RENDERING_MODE_SHADERS = 1 << 1,

View File

@ -73,6 +73,7 @@
#include "gtkrenderbackgroundprivate.h" #include "gtkrenderbackgroundprivate.h"
#include "gtkcssshadowsvalueprivate.h" #include "gtkcssshadowsvalueprivate.h"
#include "gtkdebugupdatesprivate.h" #include "gtkdebugupdatesprivate.h"
#include "gsk/gskdebugprivate.h"
#include "inspector/window.h" #include "inspector/window.h"
@ -15223,6 +15224,13 @@ gtk_widget_snapshot (GtkWidget *widget,
gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot);
} }
static gboolean
should_record_names (GtkWidget *widget)
{
return gtk_inspector_is_recording (widget) ||
gsk_check_debug_flags (GSK_DEBUG_ANY);
}
void void
gtk_widget_render (GtkWidget *widget, gtk_widget_render (GtkWidget *widget,
GdkWindow *window, GdkWindow *window,
@ -15247,7 +15255,7 @@ gtk_widget_render (GtkWidget *widget,
gtk_snapshot_init (&snapshot, gtk_snapshot_init (&snapshot,
renderer, renderer,
gtk_inspector_is_recording (widget), should_record_names (widget),
clip, clip,
"Render<%s>", G_OBJECT_TYPE_NAME (widget)); "Render<%s>", G_OBJECT_TYPE_NAME (widget));
cairo_region_destroy (clip); cairo_region_destroy (clip);