[gtk+] Remove gtk_container_snapshot_child



commit 47d4ad71fbc680b9a9f47be03d0fdbfcdd3cf636
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 7 17:02:20 2017 +0100

    Remove gtk_container_snapshot_child
    
    Replace it with the already existing gtk_widget_snapshot_child.

 docs/reference/gtk/gtk4-sections.txt |    2 +-
 gtk/gtkbbox.c                        |    6 ++--
 gtk/gtkcombobox.c                    |    4 +-
 gtk/gtkcontainer.c                   |   45 ++-------------------------------
 gtk/gtkcontainer.h                   |    4 ---
 gtk/gtkfixed.c                       |    7 +++--
 gtk/gtkmodelbutton.c                 |    2 +-
 gtk/gtknotebook.c                    |   12 ++++----
 gtk/gtkpaned.c                       |    4 +-
 gtk/gtkpopover.c                     |    2 +-
 gtk/gtkrevealer.c                    |    5 ++-
 gtk/gtkstack.c                       |   24 +++++++++---------
 gtk/gtktoolbar.c                     |    8 +++---
 gtk/gtktreeview.c                    |   10 ++++----
 gtk/gtkwidget.c                      |   20 +++++++++++++++
 gtk/gtkwidget.h                      |    4 +++
 gtk/gtkwidgetprivate.h               |    5 ----
 gtk/gtkwindow.c                      |    6 ++--
 18 files changed, 74 insertions(+), 96 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 324dde5..220d5c3 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -735,7 +735,6 @@ 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
@@ -4650,6 +4649,7 @@ gtk_widget_set_opacity
 gtk_widget_list_action_prefixes
 gtk_widget_get_action_group
 gtk_widget_measure
+gtk_widget_snapshot_child
 
 <SUBSECTION>
 gtk_widget_get_path
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index d44e62b..34c338a 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 4da7cba..49a9f36 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 39fc7c4..8968983 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 81c4334..6725a80 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 6e6e584..389d6ea 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 450339b..21dceec 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 49e9212..0afa5cb 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 cef4a77..4953ca9 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 48778fb..c848fdb 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 351c735..15c3c51 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 df58019..a4ecbb5 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 e64359d..db198b3 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 7e96e79..19c60e5 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 e61ea43..aeebdfe 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 319c7d7..d24661b 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 d4da81c..c19dd2a 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 dbdeb18..5f8e246 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]