diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 0fa2080efa..d6a9260dbb 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -735,6 +735,7 @@ gtk_container_child_notify gtk_container_child_notify_by_pspec gtk_container_forall gtk_container_propagate_draw +gtk_container_snapshot_child gtk_container_get_focus_chain gtk_container_set_focus_chain gtk_container_unset_focus_chain diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 7db677a942..4f23ece952 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -3269,6 +3269,26 @@ gtk_container_propagate_draw (GtkContainer *container, cairo_restore (cr); } +/** + * gtk_container_snapshot_child: + * @container: a #GtkContainer + * @child: a child of @container + * @snapshot: $GtkSnapshot as passed to the container. In particular, no + * calls to gtk_snapshot_translate_2d() should have been applied by the + * parent. + * + * When a container receives a call to the snapshot function, it must send + * synthetic #GtkWidget::snapshot calls to all children. This function + * provides a convenient way of doing this. A container, when it receives + * a call to its #GtkWidget::snapshot function, calls + * gtk_container_snapshot_child() once for each child, passing in + * the @snapshot the container received. + * + * gtk_container_snapshot_child() takes care of translating the origin of + * @snapshot, and deciding whether the child needs to be snapshot. It is a + * convenient and optimized way of getting the same effect as calling + * gtk_widget_snapshot() on the child directly. + **/ void gtk_container_snapshot_child (GtkContainer *container, GtkWidget *child, diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index 6725a80e25..81c4334241 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -142,6 +142,10 @@ GDK_AVAILABLE_IN_ALL void gtk_container_propagate_draw (GtkContainer *container, GtkWidget *child, cairo_t *cr); +GDK_AVAILABLE_IN_3_90 +void gtk_container_snapshot_child (GtkContainer *container, + GtkWidget *child, + GtkSnapshot *snapshot); GDK_AVAILABLE_IN_ALL void gtk_container_set_focus_chain (GtkContainer *container, diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h index c505d5542c..a0569f2812 100644 --- a/gtk/gtkcontainerprivate.h +++ b/gtk/gtkcontainerprivate.h @@ -43,10 +43,6 @@ void _gtk_container_maybe_start_idle_sizer (GtkContainer *container); void gtk_container_get_children_clip (GtkContainer *container, GtkAllocation *out_clip); -void gtk_container_snapshot_child (GtkContainer *container, - GtkWidget *child, - GtkSnapshot *snapshot); - G_END_DECLS #endif /* __GTK_CONTAINER_PRIVATE_H__ */ diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index f03a15adb4..49e921210c 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -45,7 +45,6 @@ #include "gtkwidgetpath.h" #include "gtkboxgadgetprivate.h" #include "gtkbuiltiniconprivate.h" -#include "gtkcontainerprivate.h" #include "gtkcsscustomgadgetprivate.h" #include "gtkcssstylepropertyprivate.h" #include "gtksizerequest.h"