diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-08-02 20:13:21 -0400 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2016-10-18 11:49:11 +0100 |
commit | 1d5e05b0d1dff90eea4b0c25f2ffe77a3e2bf09a (patch) | |
tree | 79e039f0e16dbf0c50ed3457698d28e10ec78b26 /gtk/gtkbutton.c | |
parent | 72ccb39f66e129a919ccc3bbcb772f5a384ad49f (diff) | |
download | gtk+-1d5e05b0d1dff90eea4b0c25f2ffe77a3e2bf09a.tar.gz |
button: Convert to indirect rendering
WARNING! This commit breaks GtkButton subclasses.
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r-- | gtk/gtkbutton.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index d363950248..b98cb75379 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -119,7 +119,8 @@ static void gtk_button_map (GtkWidget * widget); static void gtk_button_unmap (GtkWidget * widget); static void gtk_button_size_allocate (GtkWidget * widget, GtkAllocation * allocation); -static gint gtk_button_draw (GtkWidget * widget, cairo_t *cr); +static GskRenderNode *gtk_button_get_render_node (GtkWidget *widget, + GskRenderer *renderer); static gint gtk_button_grab_broken (GtkWidget * widget, GdkEventGrabBroken * event); static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event); @@ -176,13 +177,6 @@ static void gtk_button_allocate (GtkCssGadget *gadget, int baseline, GtkAllocation *out_clip, gpointer data); -static gboolean gtk_button_render (GtkCssGadget *gadget, - cairo_t *cr, - int x, - int y, - int width, - int height, - gpointer data); static GParamSpec *props[LAST_PROP] = { NULL, }; static guint button_signals[LAST_SIGNAL] = { 0 }; @@ -216,7 +210,7 @@ gtk_button_class_init (GtkButtonClass *klass) widget_class->map = gtk_button_map; widget_class->unmap = gtk_button_unmap; widget_class->size_allocate = gtk_button_size_allocate; - widget_class->draw = gtk_button_draw; + widget_class->get_render_node = gtk_button_get_render_node; widget_class->grab_broken_event = gtk_button_grab_broken; widget_class->key_release_event = gtk_button_key_release; widget_class->enter_notify_event = gtk_button_enter_notify; @@ -448,7 +442,7 @@ gtk_button_init (GtkButton *button) GTK_WIDGET (button), gtk_button_measure, gtk_button_allocate, - gtk_button_render, + NULL, NULL, NULL); @@ -870,31 +864,20 @@ gtk_button_allocate (GtkCssGadget *gadget, gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip); } -static gboolean -gtk_button_draw (GtkWidget *widget, - cairo_t *cr) +static GskRenderNode * +gtk_button_get_render_node (GtkWidget *widget, + GskRenderer *renderer) { - gtk_css_gadget_draw (GTK_BUTTON (widget)->priv->gadget, cr); - - return FALSE; -} + GskRenderNode *res = gtk_css_gadget_get_render_node (GTK_BUTTON (widget)->priv->gadget, + renderer, + FALSE); -static gboolean -gtk_button_render (GtkCssGadget *gadget, - cairo_t *cr, - int x, - int y, - int width, - int height, - gpointer data) -{ - GtkWidget *widget; - - widget = gtk_css_gadget_get_owner (gadget); + if (res == NULL) + return NULL; - GTK_WIDGET_CLASS (gtk_button_parent_class)->draw (widget, cr); + gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res); - return gtk_widget_has_visible_focus (widget); + return res; } static void |