[gtk/wip/matthiasc/popup5: 19/152] widget: Don't snapshot foreign children



commit e5e02bcc70d3eeeb08422d2659f80c76b8ec8d66
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
    surface, since those will do their own snapshot.

 gtk/gtkwidget.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 66fbe44f73..87b8e20fd7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -70,6 +70,7 @@
 #include "gtkwidgetpathprivate.h"
 #include "gtkwindowgroup.h"
 #include "gtkwindowprivate.h"
+#include "gtknativeprivate.h"
 
 #include "a11y/gtkwidgetaccessible.h"
 #include "inspector/window.h"
@@ -13339,6 +13340,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 implement #GtkNative.
  **/
 void
 gtk_widget_snapshot_child (GtkWidget   *widget,
@@ -13350,6 +13353,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_NATIVE (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]