[gtk+] gtk: Port GtkHeaderBar to render nodes



commit e58965a3ccd4707873526c33baed729b14a2178e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Aug 4 19:19:14 2016 +0100

    gtk: Port GtkHeaderBar to render nodes

 gtk/gtkheaderbar.c |   34 ++++++++++++----------------------
 1 files changed, 12 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index ac90c64..23a5674 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -1850,31 +1850,21 @@ gtk_header_bar_set_child_property (GtkContainer *container,
     }
 }
 
-static gint
-gtk_header_bar_draw (GtkWidget *widget,
-                     cairo_t   *cr)
+static GskRenderNode *
+gtk_header_bar_get_render_node (GtkWidget   *widget,
+                                GskRenderer *renderer)
 {
   GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
+  GskRenderNode *res = gtk_css_gadget_get_render_node (priv->gadget,
+                                                       renderer,
+                                                       FALSE);
 
-  gtk_css_gadget_draw (priv->gadget, cr);
-
-  return FALSE;
-}
-
-static gboolean
-gtk_header_bar_render_contents (GtkCssGadget *gadget,
-                                cairo_t      *cr,
-                                int           x,
-                                int           y,
-                                int           width,
-                                int           height,
-                                gpointer      unused)
-{
-  GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
+  if (res == NULL)
+    return NULL;
 
-  GTK_WIDGET_CLASS (gtk_header_bar_parent_class)->draw (widget, cr);
+  gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
 
-  return FALSE;
+  return res;
 }
 
 static void
@@ -1963,11 +1953,11 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
   widget_class->get_preferred_height = gtk_header_bar_get_preferred_height;
   widget_class->get_preferred_height_for_width = gtk_header_bar_get_preferred_height_for_width;
   widget_class->get_preferred_width_for_height = gtk_header_bar_get_preferred_width_for_height;
-  widget_class->draw = gtk_header_bar_draw;
   widget_class->realize = gtk_header_bar_realize;
   widget_class->unrealize = gtk_header_bar_unrealize;
   widget_class->hierarchy_changed = gtk_header_bar_hierarchy_changed;
   widget_class->direction_changed = gtk_header_bar_direction_changed;
+  widget_class->get_render_node = gtk_header_bar_get_render_node;
 
   container_class->add = gtk_header_bar_add;
   container_class->remove = gtk_header_bar_remove;
@@ -2120,7 +2110,7 @@ gtk_header_bar_init (GtkHeaderBar *bar)
                                                      GTK_WIDGET (bar),
                                                      gtk_header_bar_get_content_size,
                                                      gtk_header_bar_allocate_contents,
-                                                     gtk_header_bar_render_contents,
+                                                     NULL,
                                                      NULL,
                                                      NULL);
 


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