[gtk+] GtkButtonBox: Convert to indirect rendering
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkButtonBox: Convert to indirect rendering
- Date: Tue, 18 Oct 2016 10:59:39 +0000 (UTC)
commit b8acd23a8620672efca8f055cbed183c9f13a253
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 6 23:45:43 2016 -0400
GtkButtonBox: Convert to indirect rendering
gtk/gtkbbox.c | 65 +++++++++++++++------------------------------------------
1 files changed, 17 insertions(+), 48 deletions(-)
---
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 2616af8..3d2a8ef 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -92,8 +92,9 @@ static void gtk_button_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static gboolean gtk_button_box_draw (GtkWidget *widget,
- cairo_t *cr);
+static GskRenderNode *gtk_button_box_get_render_node (GtkWidget *widget,
+ GskRenderer *renderer);
+
static void gtk_button_box_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
@@ -143,13 +144,6 @@ static void gtk_button_box_allocate (GtkCssGadget *gadget,
int baseline,
GtkAllocation *out_clip,
gpointer unused);
-static gboolean gtk_button_box_render (GtkCssGadget *gadget,
- cairo_t *cr,
- int x,
- int y,
- int width,
- int height,
- gpointer data);
#define DEFAULT_LAYOUT_STYLE GTK_BUTTONBOX_EDGE
@@ -193,7 +187,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
widget_class->get_preferred_height_for_width = gtk_button_box_get_preferred_height_for_width;
widget_class->get_preferred_height_and_baseline_for_width =
gtk_button_box_get_preferred_height_and_baseline_for_width;
widget_class->size_allocate = gtk_button_box_size_allocate;
- widget_class->draw = gtk_button_box_draw;
+ widget_class->get_render_node = gtk_button_box_get_render_node;
container_class->remove = gtk_button_box_remove;
container_class->add = gtk_button_box_add;
@@ -228,49 +222,24 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
gtk_widget_class_set_css_name (widget_class, "buttonbox");
}
-static gboolean
-gtk_button_box_render (GtkCssGadget *gadget,
- cairo_t *cr,
- int x,
- int y,
- int width,
- int height,
- gpointer unused)
-{
- GtkWidget *widget;
- GList *children, *l;
-
- widget = gtk_css_gadget_get_owner (gadget);
- children = gtk_container_get_children (GTK_CONTAINER (widget));
-
- for (l = children; l; l = l->next)
- {
- GtkWidget *child = l->data;
-
- gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
- }
-
- g_list_free (children);
-
- return FALSE;
-}
-
-
-static gboolean
-gtk_button_box_draw (GtkWidget *widget,
- cairo_t *cr)
+static GskRenderNode *
+gtk_button_box_get_render_node (GtkWidget *widget,
+ GskRenderer *renderer)
{
GtkButtonBoxPrivate *priv = GTK_BUTTON_BOX (widget)->priv;
- GtkCssGadget *gadget;
+ GskRenderNode *res;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
- gadget = gtk_box_get_gadget (GTK_BOX (widget));
- else
- gadget = priv->gadget;
+ return GTK_WIDGET_CLASS (gtk_button_box_parent_class)->get_render_node (widget, renderer);
+
+ res = gtk_css_gadget_get_render_node (priv->gadget, renderer, FALSE);
- gtk_css_gadget_draw (gadget, cr);
+ if (res == NULL)
+ return NULL;
- return FALSE;
+ gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
+
+ return res;
}
static void
@@ -285,7 +254,7 @@ gtk_button_box_init (GtkButtonBox *button_box)
GTK_WIDGET (button_box),
gtk_button_box_measure,
gtk_button_box_allocate,
- gtk_button_box_render,
+ NULL,
NULL,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]