diff options
author | Benjamin Otte <otte@redhat.com> | 2018-04-04 12:38:09 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-04-05 14:57:10 +0200 |
commit | de990614d702cb9202e39a22d0d3ddbba040441d (patch) | |
tree | a15915b7ef50a3a6760450101d60ae4f677fdd9e /gtk/inspector/window.c | |
parent | cbf26fbd02f365c0dfe8b210ffd8fe4c18a16e06 (diff) | |
download | gtk+-de990614d702cb9202e39a22d0d3ddbba040441d.tar.gz |
inspector: Introduce so-called "overlays"
Overlays are drawings that get rendered on top of the inspected window.
The only overlay in existence so far is the highlight overlay, which is
used to highlight widgets and replaces the "draw" signal handler used
previously.
Diffstat (limited to 'gtk/inspector/window.c')
-rw-r--r-- | gtk/inspector/window.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 428de723c6..13b0ff7b6c 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -356,6 +356,30 @@ gtk_inspector_window_new (void) } void +gtk_inspector_window_add_overlay (GtkInspectorWindow *iw, + GtkInspectorOverlay *overlay) +{ + iw->overlays = g_list_prepend (iw->overlays, g_object_ref (overlay)); + + gtk_inspector_overlay_queue_draw (overlay); +} + +void +gtk_inspector_window_remove_overlay (GtkInspectorWindow *iw, + GtkInspectorOverlay *overlay) +{ + GList *item; + + item = g_list_find (iw->overlays, overlay); + if (item == NULL) + return; + + gtk_inspector_overlay_queue_draw (overlay); + + iw->overlays = g_list_delete_link (iw->overlays, item); +} + +void gtk_inspector_window_rescan (GtkWidget *widget) { GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (widget); @@ -393,6 +417,23 @@ gtk_inspector_prepare_render (GtkWidget *widget, region, node); + if (iw->overlays) + { + GtkSnapshot *snapshot; + GList *l; + + snapshot = gtk_snapshot_new (FALSE, "Inspector Overlay"); + gtk_snapshot_append_node (snapshot, node); + + for (l = iw->overlays; l; l = l->next) + { + gtk_inspector_overlay_snapshot (l->data, snapshot, widget); + } + + gsk_render_node_unref (node); + node = gtk_snapshot_free_to_node (snapshot); + } + return node; } |