[gtk+/wip/ebassi/gsk-renderer: 98/103] button: Convert to indirect rendering



commit fabde7a51ecc731de1be650abe8ccd8f5c972c8d
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 2 20:13:21 2016 -0400

    button: Convert to indirect rendering
    
    WARNING! This commit breaks GtkButton subclasses.

 gtk/gtkbutton.c |   45 ++++++++++++++-------------------------------
 1 files changed, 14 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 8c570a9..e7e89de 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -134,7 +134,8 @@ static void gtk_button_unmap (GtkWidget * widget);
 static void gtk_button_style_updated (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);
@@ -209,13 +210,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 };
@@ -257,7 +251,7 @@ gtk_button_class_init (GtkButtonClass *klass)
   widget_class->unmap = gtk_button_unmap;
   widget_class->style_updated = gtk_button_style_updated;
   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;
@@ -748,7 +742,7 @@ gtk_button_init (GtkButton *button)
                                                      GTK_WIDGET (button),
                                                      gtk_button_measure,
                                                      gtk_button_allocate,
-                                                     gtk_button_render,
+                                                     NULL,
                                                      NULL,
                                                      NULL);
 
@@ -1799,31 +1793,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


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