[gtk+/wip/baedert/drawing: 8/17] stack: Remove gadget



commit bfb7f31faa6ff1725113f9596c34bd6d5eeef33c
Author: Timm Bäder <mail baedert org>
Date:   Fri May 5 17:18:15 2017 +0200

    stack: Remove gadget

 gtk/gtkstack.c |   75 ++++++++-----------------------------------------------
 1 files changed, 11 insertions(+), 64 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index d5ab3b5..3a9db36 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -25,7 +25,6 @@
 #include "gtkstack.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
-#include "gtkcsscustomgadgetprivate.h"
 #include "gtkcontainerprivate.h"
 #include "gtkprogresstrackerprivate.h"
 #include "gtksettingsprivate.h"
@@ -137,8 +136,6 @@ typedef struct {
 
   GtkStackChildInfo *visible_child;
 
-  GtkCssGadget *gadget;
-
   gboolean hhomogeneous;
   gboolean vhomogeneous;
 
@@ -178,7 +175,7 @@ static void     gtk_stack_size_allocate                  (GtkWidget     *widget,
                                                           GtkAllocation *allocation);
 static void     gtk_stack_snapshot                       (GtkWidget     *widget,
                                                           GtkSnapshot   *snapshot);
-static void     gtk_stack_measure_                       (GtkWidget      *widget,
+static void     gtk_stack_measure                        (GtkWidget      *widget,
                                                           GtkOrientation  orientation,
                                                           int             for_size,
                                                           int            *minimum,
@@ -222,8 +219,6 @@ gtk_stack_finalize (GObject *obj)
 
   g_clear_pointer (&priv->last_visible_node, gsk_render_node_unref);
 
-  g_clear_object (&priv->gadget);
-
   G_OBJECT_CLASS (gtk_stack_parent_class)->finalize (obj);
 }
 
@@ -322,7 +317,7 @@ gtk_stack_realize (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (gtk_stack_parent_class)->realize (widget);
 
-  gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);
+  gtk_widget_get_content_allocation (widget, &allocation);
 
   priv->view_window =
     gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (stack)),
@@ -412,7 +407,7 @@ gtk_stack_class_init (GtkStackClass *klass)
   widget_class->unrealize = gtk_stack_unrealize;
   widget_class->map = gtk_stack_map;
   widget_class->unmap = gtk_stack_unmap;
-  widget_class->measure = gtk_stack_measure_;
+  widget_class->measure = gtk_stack_measure;
   widget_class->compute_expand = gtk_stack_compute_expand;
 
   container_class->add = gtk_stack_add;
@@ -2142,33 +2137,8 @@ gtk_stack_size_allocate (GtkWidget     *widget,
   GtkStack *stack = GTK_STACK (widget);
   GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
   GtkAllocation clip = *allocation;
-
-  gtk_css_gadget_allocate (priv->gadget,
-                           allocation,
-                           gtk_widget_get_allocated_baseline (widget),
-                           &clip);
-  clip.x += allocation->x;
-  clip.y += allocation->y;
-
-  gtk_widget_set_clip (widget, &clip);
-}
-
-static void
-gtk_stack_allocate (GtkCssGadget        *gadget,
-                    const GtkAllocation *allocation,
-                    int                  baseline,
-                    GtkAllocation       *out_clip,
-                    gpointer             data)
-{
-  GtkWidget *widget;
-  GtkStack *stack;
-  GtkStackPrivate *priv;
   GtkAllocation child_allocation;
 
-  widget = gtk_css_gadget_get_owner (gadget);
-  stack = GTK_STACK (widget);
-  priv = gtk_stack_get_instance_private (stack);
-
   child_allocation.x = 0;
   child_allocation.y = 0;
 
@@ -2242,39 +2212,25 @@ gtk_stack_allocate (GtkCssGadget        *gadget,
 
       gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
     }
-  gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
-}
-static void
-gtk_stack_measure_ (GtkWidget      *widget,
-                    GtkOrientation  orientation,
-                    int             for_size,
-                    int            *minimum,
-                    int            *natural,
-                    int            *minimum_baseline,
-                    int            *natural_baseline)
-{
-  GtkStackPrivate *priv = gtk_stack_get_instance_private (GTK_STACK (widget));
 
-  gtk_css_gadget_get_preferred_size (priv->gadget,
-                                     orientation,
-                                     for_size,
-                                     minimum, natural,
-                                     minimum_baseline, natural_baseline);
+  gtk_container_get_children_clip (GTK_CONTAINER (widget), &clip);
+
+  clip.x += allocation->x;
+  clip.y += allocation->y;
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 #define LERP(a, b, t) ((a) + (((b) - (a)) * (1.0 - (t))))
-
 static void
-gtk_stack_measure (GtkCssGadget   *gadget,
+gtk_stack_measure (GtkWidget      *widget,
                    GtkOrientation  orientation,
                    int             for_size,
                    int            *minimum,
                    int            *natural,
                    int            *minimum_baseline,
-                   int            *natural_baseline,
-                   gpointer        data)
+                   int            *natural_baseline)
 {
-  GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
   GtkStack *stack = GTK_STACK (widget);
   GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
   GtkStackChildInfo *child_info;
@@ -2332,13 +2288,4 @@ gtk_stack_init (GtkStack *stack)
   priv->hhomogeneous = TRUE;
   priv->transition_duration = 200;
   priv->transition_type = GTK_STACK_TRANSITION_TYPE_NONE;
-
-  priv->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (stack)),
-                                                     GTK_WIDGET (stack),
-                                                     gtk_stack_measure,
-                                                     gtk_stack_allocate,
-                                                     NULL,
-                                                     NULL,
-                                                     NULL);
-
 }


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