[gtk/wip/matthiasc/popup4: 32/110] widget: Don't snapshot foreign children



commit c0d7392eed8c5c3b8f4c5768cf73a0f2a6662692
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 18 07:51:47 2019 -0400

    widget: Don't snapshot foreign children
    
    When snapshotting, we walk down the widget tree.
    We need to skip children that have a different
    root, since those will do their own snapshot.

 gtk/gtkwidget.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ca8dd1b28d..1b6fa0eee0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -813,7 +813,9 @@ gtk_widget_real_snapshot (GtkWidget   *widget,
   for (child = _gtk_widget_get_first_child (widget);
        child != NULL;
        child = _gtk_widget_get_next_sibling (child))
-    gtk_widget_snapshot_child (widget, child, snapshot);
+    {
+      gtk_widget_snapshot_child (widget, child, snapshot);
+    }
 }
 
 static gboolean
@@ -13302,6 +13304,8 @@ gtk_widget_forall (GtkWidget   *widget,
  *
  * gtk_widget_snapshot_child() takes care of translating the origin of
  * @snapshot, and deciding whether the child needs to be snapshot.
+ *
+ * This function does nothing for children that are roots themselves.
  **/
 void
 gtk_widget_snapshot_child (GtkWidget   *widget,
@@ -13313,6 +13317,9 @@ gtk_widget_snapshot_child (GtkWidget   *widget,
   g_return_if_fail (_gtk_widget_get_parent (child) == widget);
   g_return_if_fail (snapshot != NULL);
 
+  if (GTK_IS_ROOT (child))
+    return;
+
   gtk_snapshot_save (snapshot);
   gtk_snapshot_transform (snapshot, priv->transform);
 


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