inspector: Change semantics of inspector render node notify

Instead of just notifying the inspector of what is going to be rendered,
allow the inspector to modify it.

This way, the inspector can overlay information it deems relevant over
the render node while still having access to what the actual widget
(without the inspector) would paint.
This commit is contained in:
Benjamin Otte 2018-04-03 21:09:35 +02:00
parent 0ea8395c03
commit 6c55096933
3 changed files with 23 additions and 21 deletions

View File

@ -13509,11 +13509,11 @@ gtk_widget_render (GtkWidget *widget,
if (root != NULL)
{
gtk_inspector_record_render (widget,
renderer,
surface,
region,
root);
root = gtk_inspector_prepare_render (widget,
renderer,
surface,
region,
root);
gsk_renderer_render (renderer, root, region);

View File

@ -369,22 +369,22 @@ gtk_inspector_window_get_for_display (GdkDisplay *display)
return g_object_get_data (G_OBJECT (display), "-gtk-inspector");
}
void
gtk_inspector_record_render (GtkWidget *widget,
GskRenderer *renderer,
GdkSurface *surface,
const cairo_region_t *region,
GskRenderNode *node)
GskRenderNode *
gtk_inspector_prepare_render (GtkWidget *widget,
GskRenderer *renderer,
GdkSurface *surface,
const cairo_region_t *region,
GskRenderNode *node)
{
GtkInspectorWindow *iw;
iw = gtk_inspector_window_get_for_display (gtk_widget_get_display (widget));
if (iw == NULL)
return;
return node;
/* sanity check for single-display GDK backends */
if (GTK_WIDGET (iw) == widget)
return;
return node;
gtk_inspector_recorder_record_render (GTK_INSPECTOR_RECORDER (iw->widget_recorder),
widget,
@ -392,6 +392,8 @@ gtk_inspector_record_render (GtkWidget *widget,
surface,
region,
node);
return node;
}
gboolean

View File

@ -102,16 +102,16 @@ void gtk_inspector_stop_highlight (GtkWidget *widget);
void gtk_inspector_on_inspect (GtkWidget *widget,
GtkInspectorWindow *iw);
void gtk_inspector_window_select_widget_under_pointer (GtkInspectorWindow *iw);
void gtk_inspector_window_select_widget_under_pointer (GtkInspectorWindow *iw);
void gtk_inspector_window_rescan (GtkWidget *iw);
void gtk_inspector_window_rescan (GtkWidget *iw);
gboolean gtk_inspector_is_recording (GtkWidget *widget);
void gtk_inspector_record_render (GtkWidget *widget,
GskRenderer *renderer,
GdkSurface *surface,
const cairo_region_t *region,
GskRenderNode *node);
gboolean gtk_inspector_is_recording (GtkWidget *widget);
GskRenderNode * gtk_inspector_prepare_render (GtkWidget *widget,
GskRenderer *renderer,
GdkSurface *surface,
const cairo_region_t *region,
GskRenderNode *node);
G_END_DECLS