[gtk+/wip/otte/snapshot: 13/30] snapshot: convert GtkBox



commit 8dbebd9d30550eaa50fa52e194331209c16ac99c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Nov 14 00:52:40 2016 +0100

    snapshot: convert GtkBox

 gtk/gtkbox.c |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 4f4f395..8cfc49d 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -201,8 +201,8 @@ static void gtk_box_measure (GtkWidget      *widget,
                              int            *natural,
                              int            *minimum_baseline,
                              int            *natural_baseline);
-static GskRenderNode *  gtk_box_get_render_node                 (GtkWidget            *widget,
-                                                                 GskRenderer          *renderer);
+static void gtk_box_snapshot (GtkWidget   *widget,
+                              GtkSnapshot *snapshot);
 
 static void               gtk_box_buildable_init                 (GtkBuildableIface  *iface);
 
@@ -233,10 +233,10 @@ gtk_box_class_init (GtkBoxClass *class)
   object_class->get_property = gtk_box_get_property;
   object_class->dispose = gtk_box_dispose;
 
-  widget_class->get_render_node                = gtk_box_get_render_node;
-  widget_class->size_allocate                  = gtk_box_size_allocate;
-  widget_class->measure                        = gtk_box_measure;
-  widget_class->direction_changed              = gtk_box_direction_changed;
+  widget_class->snapshot = gtk_box_snapshot;
+  widget_class->size_allocate = gtk_box_size_allocate;
+  widget_class->measure = gtk_box_measure;
+  widget_class->direction_changed = gtk_box_direction_changed;
 
   container_class->add = gtk_box_add;
   container_class->remove = gtk_box_remove;
@@ -397,20 +397,25 @@ gtk_box_get_property (GObject    *object,
     }
 }
 
-static GskRenderNode *
-gtk_box_get_render_node (GtkWidget   *widget,
-                         GskRenderer *renderer)
+static gboolean
+gtk_box_snapshot_contents (GtkCssGadget *gadget,
+                           GtkSnapshot  *snapshot,
+                           int           x,
+                           int           y,
+                           int           width,
+                           int           height,
+                           gpointer      data)
 {
-  GskRenderNode *res = gtk_css_gadget_get_render_node (GTK_BOX (widget)->priv->gadget,
-                                                       renderer,
-                                                       FALSE);
+  GTK_WIDGET_CLASS (gtk_box_parent_class)->snapshot (gtk_css_gadget_get_owner (gadget), snapshot);
 
-  if (res == NULL)
-    return NULL;
-
-  gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
+  return FALSE;
+}
 
-  return res;
+static void
+gtk_box_snapshot (GtkWidget   *widget,
+                  GtkSnapshot *snapshot)
+{
+  gtk_css_gadget_snapshot (GTK_BOX (widget)->priv->gadget, snapshot);
 }
 
 static void
@@ -1970,7 +1975,7 @@ gtk_box_init (GtkBox *box)
                                                         gtk_box_get_content_size,
                                                         gtk_box_allocate_contents,
                                                         NULL,
-                                                        NULL,
+                                                        gtk_box_snapshot_contents,
                                                         NULL,
                                                         NULL);
 


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