diff options
author | Timm Bäder <mail@baedert.org> | 2017-01-07 17:02:20 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-01-07 17:19:30 +0100 |
commit | 47d4ad71fbc680b9a9f47be03d0fdbfcdd3cf636 (patch) | |
tree | 9657e68685d2b5163258cf21715a2c336c23022a /gtk | |
parent | f486805ba094751bb842aa60237448fdc2311f2b (diff) | |
download | gtk+-47d4ad71fbc680b9a9f47be03d0fdbfcdd3cf636.tar.gz |
Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkbbox.c | 6 | ||||
-rw-r--r-- | gtk/gtkcombobox.c | 4 | ||||
-rw-r--r-- | gtk/gtkcontainer.c | 45 | ||||
-rw-r--r-- | gtk/gtkcontainer.h | 4 | ||||
-rw-r--r-- | gtk/gtkfixed.c | 7 | ||||
-rw-r--r-- | gtk/gtkmodelbutton.c | 2 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 12 | ||||
-rw-r--r-- | gtk/gtkpaned.c | 4 | ||||
-rw-r--r-- | gtk/gtkpopover.c | 2 | ||||
-rw-r--r-- | gtk/gtkrevealer.c | 5 | ||||
-rw-r--r-- | gtk/gtkstack.c | 24 | ||||
-rw-r--r-- | gtk/gtktoolbar.c | 8 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 10 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 20 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 4 | ||||
-rw-r--r-- | gtk/gtkwidgetprivate.h | 5 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 6 |
17 files changed, 73 insertions, 95 deletions
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index d44e62b507..34c338aeaf 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -214,9 +214,9 @@ static void gtk_button_box_snapshot_forall (GtkWidget *child, gpointer snapshot) { - gtk_container_snapshot_child (GTK_CONTAINER (gtk_widget_get_parent (child)), - child, - snapshot); + gtk_widget_snapshot_child (gtk_widget_get_parent (child), + child, + snapshot); } static gboolean diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 4da7cbaca6..49a9f36483 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -474,8 +474,8 @@ gtk_combo_box_render (GtkCssGadget *gadget, GtkComboBox *combo_box = GTK_COMBO_BOX (widget); GtkComboBoxPrivate *priv = combo_box->priv; - gtk_container_snapshot_child (GTK_CONTAINER (widget), - priv->box, snapshot); + gtk_widget_snapshot_child (widget, + priv->box, snapshot); return FALSE; } diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 39fc7c44e3..8968983886 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -3067,9 +3067,9 @@ static void gtk_container_snapshot_forall (GtkWidget *child, gpointer snapshot) { - gtk_container_snapshot_child (GTK_CONTAINER (_gtk_widget_get_parent (child)), - child, - snapshot); + gtk_widget_snapshot_child (_gtk_widget_get_parent (child), + child, + snapshot); } static void @@ -3222,45 +3222,6 @@ gtk_container_propagate_draw (GtkContainer *container, } /** - * 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, - GtkSnapshot *snapshot) -{ - int x, y; - - g_return_if_fail (GTK_IS_CONTAINER (container)); - g_return_if_fail (GTK_IS_WIDGET (child)); - g_return_if_fail (_gtk_widget_get_parent (child) == GTK_WIDGET (container)); - g_return_if_fail (snapshot != NULL); - - gtk_container_get_translation_to_child (container, child, &x, &y); - - gtk_snapshot_translate_2d (snapshot, x, y); - gtk_widget_snapshot (child, snapshot); - gtk_snapshot_translate_2d (snapshot, -x, -y); -} - -/** * gtk_container_get_path_for_child: * @container: a #GtkContainer * @child: a child of @container diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index 81c4334241..6725a80e25 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -142,10 +142,6 @@ 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/gtkfixed.c b/gtk/gtkfixed.c index 6e6e5846c3..389d6ea655 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -71,6 +71,7 @@ #include "gtkfixed.h" #include "gtkcontainerprivate.h" +#include "gtkwidgetprivate.h" #include "gtkprivate.h" #include "gtkintl.h" @@ -531,9 +532,9 @@ gtk_fixed_snapshot (GtkWidget *widget, { child = list->data; - gtk_container_snapshot_child (GTK_CONTAINER (fixed), - child->widget, - snapshot); + gtk_widget_snapshot_child (widget, + child->widget, + snapshot); } } diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index 450339b4a9..21dceeccdc 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -935,7 +935,7 @@ gtk_model_button_render (GtkCssGadget *gadget, child = gtk_bin_get_child (GTK_BIN (widget)); if (child) - gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot); + gtk_widget_snapshot_child (widget, child, snapshot); return gtk_widget_has_visible_focus (widget); } diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 49e921210c..0afa5cb6c4 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2369,9 +2369,9 @@ gtk_notebook_snapshot_stack (GtkCssGadget *gadget, GtkNotebookPrivate *priv = notebook->priv; if (gtk_notebook_has_current_page (notebook)) - gtk_container_snapshot_child (GTK_CONTAINER (notebook), - priv->cur_page->child, - snapshot); + gtk_widget_snapshot_child (widget, + priv->cur_page->child, + snapshot); return FALSE; } @@ -4588,9 +4588,9 @@ snapshot_tab (GtkCssGadget *gadget, widget = gtk_css_gadget_get_owner (gadget); - gtk_container_snapshot_child (GTK_CONTAINER (widget), - page->tab_label, - snapshot); + gtk_widget_snapshot_child (widget, + page->tab_label, + snapshot); return gtk_widget_has_visible_focus (widget) && GTK_NOTEBOOK (widget)->priv->cur_page == page; diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index cef4a7740a..4953ca943d 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1678,7 +1678,7 @@ gtk_paned_render (GtkCssGadget *gadget, gdk_window_get_height (priv->child1_window) ), "GtkPanedChild1"); - gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->child1, snapshot); + gtk_widget_snapshot_child (widget, priv->child1, snapshot); gtk_snapshot_pop_and_append (snapshot); } @@ -1693,7 +1693,7 @@ gtk_paned_render (GtkCssGadget *gadget, gdk_window_get_height (priv->child2_window) ), "GtkPanedChild2"); - gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->child2, snapshot); + gtk_widget_snapshot_child (widget, priv->child2, snapshot); gtk_snapshot_pop_and_append (snapshot); } diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 48778fb954..c848fdb425 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1199,7 +1199,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS child = gtk_bin_get_child (GTK_BIN (widget)); if (child) - gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot); + gtk_widget_snapshot_child (widget, child, snapshot); } static void diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index 351c73540f..15c3c51e1c 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -30,6 +30,7 @@ #include "gtksettingsprivate.h" #include "gtksnapshot.h" #include "gtktypebuiltins.h" +#include "gtkwidgetprivate.h" #include "fallback-c89.c" @@ -838,7 +839,7 @@ gtk_revealer_snapshot (GtkWidget *widget, transition = effective_transition (revealer); if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE) { - gtk_container_snapshot_child (GTK_CONTAINER (revealer), child, snapshot); + gtk_widget_snapshot_child (widget, child, snapshot); } else { @@ -849,7 +850,7 @@ gtk_revealer_snapshot (GtkWidget *widget, gtk_widget_get_allocated_height (widget) ), "RevealerClip"); - gtk_container_snapshot_child (GTK_CONTAINER (revealer), child, snapshot); + gtk_widget_snapshot_child (widget, child, snapshot); gtk_snapshot_pop_and_append (snapshot); } } diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index df580192cc..a4ecbb5291 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -1917,9 +1917,9 @@ gtk_stack_snapshot_crossfade (GtkWidget *widget, char *name; gtk_snapshot_push (snapshot, TRUE, "GtkStackCrossFadeEnd"); - gtk_container_snapshot_child (GTK_CONTAINER (stack), - priv->visible_child->widget, - snapshot); + gtk_widget_snapshot_child (widget, + priv->visible_child->widget, + snapshot); end_node = gtk_snapshot_pop (snapshot); if (priv->last_visible_node) @@ -1995,9 +1995,9 @@ gtk_stack_snapshot_under (GtkWidget *widget, &GRAPHENE_RECT_INIT(x, y, width, height), "StackUnder"); - gtk_container_snapshot_child (GTK_CONTAINER (stack), - priv->visible_child->widget, - snapshot); + gtk_widget_snapshot_child (widget, + priv->visible_child->widget, + snapshot); gtk_snapshot_pop_and_append (snapshot); @@ -2073,9 +2073,9 @@ gtk_stack_snapshot_slide (GtkWidget *widget, gtk_snapshot_pop_and_append (snapshot); } - gtk_container_snapshot_child (GTK_CONTAINER (stack), - priv->visible_child->widget, - snapshot); + gtk_widget_snapshot_child (widget, + priv->visible_child->widget, + snapshot); } static void @@ -2151,9 +2151,9 @@ gtk_stack_render (GtkCssGadget *gadget, gtk_snapshot_pop_and_append (snapshot); } else - gtk_container_snapshot_child (GTK_CONTAINER (stack), - priv->visible_child->widget, - snapshot); + gtk_widget_snapshot_child (widget, + priv->visible_child->widget, + snapshot); } return FALSE; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index e64359da81..db198b3883 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -838,9 +838,9 @@ gtk_toolbar_render (GtkCssGadget *gadget, toolbar_content_snapshot (content, GTK_CONTAINER (widget), snapshot); } - gtk_container_snapshot_child (GTK_CONTAINER (widget), - priv->arrow_button, - snapshot); + gtk_widget_snapshot_child (widget, + priv->arrow_button, + snapshot); return FALSE; } @@ -3156,7 +3156,7 @@ toolbar_content_snapshot (ToolbarContent *content, widget = GTK_WIDGET (content->item); if (widget) - gtk_container_snapshot_child (container, widget, snapshot); + gtk_widget_snapshot_child (GTK_WIDGET (container), widget, snapshot); } static gboolean diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 7e96e793d6..19c60e56c3 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -5409,7 +5409,7 @@ gtk_tree_view_snapshot (GtkWidget *widget, { GtkTreeViewChild *child = list->data; - gtk_container_snapshot_child (GTK_CONTAINER (tree_view), child->widget, snapshot); + gtk_widget_snapshot_child (widget, child->widget, snapshot); } gtk_snapshot_pop_and_append (snapshot); @@ -5464,16 +5464,16 @@ gtk_tree_view_snapshot (GtkWidget *widget, if (gtk_tree_view_column_get_visible (column)) { button = gtk_tree_view_column_get_button (column); - gtk_container_snapshot_child (GTK_CONTAINER (tree_view), - button, snapshot); + gtk_widget_snapshot_child (widget, + button, snapshot); } } if (tree_view->priv->drag_window) { button = gtk_tree_view_column_get_button (tree_view->priv->drag_column); - gtk_container_snapshot_child (GTK_CONTAINER (tree_view), - button, snapshot); + gtk_widget_snapshot_child (widget, + button, snapshot); } gtk_style_context_restore (context); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index e61ea43406..aeebdfe438 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -15786,6 +15786,26 @@ gtk_widget_get_translation_to_child (GtkWidget *widget, *y_out = y; } +/** + * gtk_widget_snapshot_child: + * @widget: a #GtkWidget + * @child: a child of @widget + * @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 widget 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 widget, when it receives + * a call to its #GtkWidget::snapshot function, calls + * gtk_widget_snapshot_child() once for each child, passing in + * the @snapshot the widget received. + * + * gtk_widget_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_widget_snapshot_child (GtkWidget *widget, GtkWidget *child, diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 319c7d76d4..d24661b705 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -1261,6 +1261,10 @@ GtkWidget * gtk_widget_get_prev_sibling (GtkWidget *widget); GDK_AVAILABLE_IN_3_90 void gtk_widget_set_focus_child (GtkWidget *widget, GtkWidget *child); +GDK_AVAILABLE_IN_3_90 +void gtk_widget_snapshot_child (GtkWidget *widget, + GtkWidget *child, + GtkSnapshot *snapshot); G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free) diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index d4da81c08e..c19dd2a966 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -304,11 +304,6 @@ void gtk_widget_forall (GtkWidget GtkCallback callback, gpointer user_data); -void gtk_widget_snapshot_child (GtkWidget *widget, - GtkWidget *child, - GtkSnapshot *snapshot); - - /* inline getters */ static inline gboolean diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index dbdeb18880..5f8e2464cf 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -9461,15 +9461,15 @@ gtk_window_snapshot (GtkWidget *widget, (window_border.top + window_border.bottom + title_height)); if (priv->title_box != NULL) - gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->title_box, snapshot); + gtk_widget_snapshot_child (widget, priv->title_box, snapshot); if (gtk_bin_get_child (GTK_BIN (widget))) - gtk_container_snapshot_child (GTK_CONTAINER (widget), gtk_bin_get_child (GTK_BIN (widget)), snapshot); + gtk_widget_snapshot_child (widget, gtk_bin_get_child (GTK_BIN (widget)), snapshot); for (l = priv->popovers; l; l = l->next) { GtkWindowPopover *data = l->data; - gtk_container_snapshot_child (GTK_CONTAINER (widget), data->widget, snapshot); + gtk_widget_snapshot_child (widget, data->widget, snapshot); } gtk_debug_updates_snapshot (widget, snapshot); |