[gtk+/wip/baedert/drawing: 74/186] label: Remove gadget



commit 6f03b8eed0541344375080f700b42883c16d0645
Author: Timm Bäder <mail baedert org>
Date:   Thu May 4 16:14:47 2017 +0200

    label: Remove gadget

 gtk/gtklabel.c |   68 ++++++++-----------------------------------------------
 1 files changed, 10 insertions(+), 58 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 61682cc..98466de 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -55,7 +55,6 @@
 #include "gtkwidgetprivate.h"
 #include "gtkwindow.h"
 #include "gtkcssnodeprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
 #include "gtkwidgetprivate.h"
 
 #include "a11y/gtklabelaccessibleprivate.h"
@@ -253,7 +252,6 @@ struct _GtkLabelPrivate
   GtkLabelSelectionInfo *select_info;
   GtkWidget *mnemonic_widget;
   GtkWindow *mnemonic_window;
-  GtkCssGadget *gadget;
 
   PangoAttrList *attrs;
   PangoAttrList *markup_attrs;
@@ -541,7 +539,7 @@ static void   gtk_label_drag_gesture_update         (GtkGestureDrag *gesture,
                                                      GtkLabel       *label);
 
 static GtkSizeRequestMode gtk_label_get_request_mode                (GtkWidget           *widget);
-static void     gtk_label_measure_ (GtkWidget     *widget,
+static void     gtk_label_measure (GtkWidget     *widget,
                                    GtkOrientation  orientation,
                                    int             for_size,
                                    int            *minimum,
@@ -549,15 +547,6 @@ static void     gtk_label_measure_ (GtkWidget     *widget,
                                    int            *minimum_baseline,
                                    int            *natural_baseline);
 
-static void     gtk_label_measure (GtkCssGadget   *gadget,
-                                   GtkOrientation  orientation,
-                                   int             for_size,
-                                   int            *minimum,
-                                   int            *natural,
-                                   int            *minimum_baseline,
-                                   int            *natural_baseline,
-                                   gpointer        unused);
-
 static GtkBuildableIface *buildable_parent_iface = NULL;
 
 G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_WIDGET,
@@ -619,7 +608,7 @@ gtk_label_class_init (GtkLabelClass *class)
   widget_class->popup_menu = gtk_label_popup_menu;
   widget_class->focus = gtk_label_focus;
   widget_class->get_request_mode = gtk_label_get_request_mode;
-  widget_class->measure = gtk_label_measure_;
+  widget_class->measure = gtk_label_measure;
 
   class->move_cursor = gtk_label_move_cursor;
   class->copy_clipboard = gtk_label_copy_clipboard;
@@ -1333,14 +1322,6 @@ gtk_label_init (GtkLabel *label)
   priv->mnemonic_window = NULL;
 
   priv->mnemonics_visible = TRUE;
-
-  priv->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (label)),
-                                                     GTK_WIDGET (label),
-                                                     gtk_label_measure,
-                                                     NULL,
-                                                     NULL,
-                                                     NULL,
-                                                     NULL);
 }
 
 
@@ -3238,8 +3219,6 @@ gtk_label_finalize (GObject *object)
   gtk_label_clear_links (label);
   g_free (priv->select_info);
 
-  g_clear_object (&priv->gadget);
-
   G_OBJECT_CLASS (gtk_label_parent_class)->finalize (object);
 }
 
@@ -3331,7 +3310,7 @@ gtk_label_update_layout_width (GtkLabel *label)
     {
       GtkAllocation allocation;
 
-      gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);
+      gtk_widget_get_content_allocation (GTK_WIDGET (label), &allocation);
 
       pango_layout_set_width (priv->layout, allocation.width * PANGO_SCALE);
     }
@@ -3618,22 +3597,16 @@ gtk_label_get_preferred_size (GtkWidget      *widget,
 }
 
 static void
-gtk_label_measure (GtkCssGadget   *gadget,
+gtk_label_measure (GtkWidget      *widget,
                    GtkOrientation  orientation,
                    int             for_size,
                    int            *minimum,
                    int            *natural,
                    int            *minimum_baseline,
-                   int            *natural_baseline,
-                   gpointer        unused)
+                   int            *natural_baseline)
 {
-  GtkWidget *widget;
-  GtkLabel *label;
-  GtkLabelPrivate *priv;
-
-  widget = gtk_css_gadget_get_owner (gadget);
-  label = GTK_LABEL (widget);
-  priv = label->priv;
+  GtkLabel *label = GTK_LABEL (widget);
+  GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
 
   if (orientation == GTK_ORIENTATION_VERTICAL && for_size != -1 && priv->wrap)
     {
@@ -3646,22 +3619,6 @@ gtk_label_measure (GtkCssGadget   *gadget,
 }
 
 static void
-gtk_label_measure_ (GtkWidget     *widget,
-                    GtkOrientation  orientation,
-                    int             for_size,
-                    int            *minimum,
-                    int            *natural,
-                    int            *minimum_baseline,
-                    int            *natural_baseline)
-{
-  gtk_css_gadget_get_preferred_size (GTK_LABEL (widget)->priv->gadget,
-                                     orientation,
-                                     for_size,
-                                     minimum, natural,
-                                     minimum_baseline, natural_baseline);
-}
-
-static void
 get_layout_location (GtkLabel  *label,
                      gint      *xp,
                      gint      *yp)
@@ -3691,9 +3648,9 @@ get_layout_location (GtkLabel  *label,
   req_width  = logical.width;
   req_height = logical.height;
 
-  gtk_css_gadget_get_content_allocation (priv->gadget,
-                                         &allocation,
-                                         &baseline);
+  gtk_widget_get_content_allocation (widget, &allocation);
+
+  baseline = gtk_widget_get_allocated_baseline (widget);
 
   x = floor (allocation.x + xalign * (allocation.width - req_width) - logical.x);
 
@@ -3762,11 +3719,6 @@ gtk_label_size_allocate (GtkWidget     *widget,
 
   GTK_WIDGET_CLASS (gtk_label_parent_class)->size_allocate (widget, allocation);
 
-  gtk_css_gadget_allocate (priv->gadget,
-                           allocation,
-                           gtk_widget_get_allocated_baseline (widget),
-                           &clip);
-
   if (priv->layout)
     gtk_label_update_layout_width (label);
 


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