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



commit ae10683e95be6d9a050a7b0ba4d4b33b212594b1
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 dbe7d82..e42e76b 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -126,7 +126,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);
@@ -195,13 +196,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 };
@@ -240,7 +234,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;
@@ -519,7 +513,7 @@ gtk_button_init (GtkButton *button)
                                                      GTK_WIDGET (button),
                                                      gtk_button_measure,
                                                      gtk_button_allocate,
-                                                     gtk_button_render,
+                                                     NULL,
                                                      NULL,
                                                      NULL);
 
@@ -1305,31 +1299,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]