[gtk+/wip/baedert/children: 21/33] widget: Remove unused adjust_* vfuncs



commit 26878539d25c74d9bace3600002533f3f39a0db9
Author: Timm Bäder <mail baedert org>
Date:   Wed Nov 23 17:46:44 2016 +0100

    widget: Remove unused adjust_* vfuncs
    
    Expose them privately to gtksizerequest.c using normal functions
    instead.

 gtk/gtksizerequest.c   |   34 ++++++++-----------
 gtk/gtkwidget.c        |   84 +++++++++++++++++++-----------------------------
 gtk/gtkwidget.h        |   48 ---------------------------
 gtk/gtkwidgetprivate.h |   15 ++++++++
 4 files changed, 63 insertions(+), 118 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index dd0eccf..c12dfc7 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -148,12 +148,12 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
              gtk_widget_get_preferred_height (widget, &minimum_height, &natural_height);
 
               /* convert for_size to unadjusted height (for_size is a proposed allocation) */
-              widget_class->adjust_size_allocation (widget,
-                                                   GTK_ORIENTATION_VERTICAL,
-                                                   &minimum_height,
-                                                   &natural_height,
-                                                   &ignored_position,
-                                                   &adjusted_for_size);
+              gtk_widget_adjust_size_allocation (widget,
+                                                 GTK_ORIENTATION_VERTICAL,
+                                                 &minimum_height,
+                                                 &natural_height,
+                                                 &ignored_position,
+                                                 &adjusted_for_size);
 
              push_recursion_check (widget, orientation, for_size);
               widget_class->measure (widget,
@@ -187,12 +187,12 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
              gtk_widget_get_preferred_width (widget, &minimum_width, &natural_width);
 
               /* convert for_size to unadjusted width (for_size is a proposed allocation) */
-              widget_class->adjust_size_allocation (widget,
-                                                   GTK_ORIENTATION_HORIZONTAL,
-                                                   &minimum_width,
-                                                   &natural_width,
-                                                   &ignored_position,
-                                                   &adjusted_for_size);
+              gtk_widget_adjust_size_allocation (widget,
+                                                 GTK_ORIENTATION_HORIZONTAL,
+                                                 &minimum_width,
+                                                 &natural_width,
+                                                 &ignored_position,
+                                                 &adjusted_for_size);
 
              push_recursion_check (widget, orientation, for_size);
               widget_class->measure (widget,
@@ -212,10 +212,8 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
 
       adjusted_min     = min_size;
       adjusted_natural = nat_size;
-      widget_class->adjust_size_request (widget,
-                                        orientation,
-                                        &adjusted_min,
-                                        &adjusted_natural);
+      gtk_widget_adjust_size_request (widget, orientation,
+                                      &adjusted_min, &adjusted_natural);
 
       if (adjusted_min < min_size ||
           adjusted_natural < nat_size)
@@ -267,9 +265,7 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
              nat_baseline = -1;
            }
          else
-           widget_class->adjust_baseline_request (widget,
-                                                  &min_baseline,
-                                                  &nat_baseline);
+      gtk_widget_adjust_baseline_request (widget, &min_baseline, &nat_baseline);
        }
 
       _gtk_size_request_cache_commit (cache,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index dfab843..125c47d 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -747,21 +747,8 @@ static GtkSizeRequestMode gtk_widget_real_get_request_mode      (GtkWidget
 static void             gtk_widget_queue_tooltip_query          (GtkWidget *widget);
 
 
-static void             gtk_widget_real_adjust_size_request     (GtkWidget         *widget,
-                                                                 GtkOrientation     orientation,
-                                                                 gint              *minimum_size,
-                                                                 gint              *natural_size);
-static void             gtk_widget_real_adjust_baseline_request (GtkWidget         *widget,
-                                                                gint              *minimum_baseline,
-                                                                gint              *natural_baseline);
-static void             gtk_widget_real_adjust_size_allocation  (GtkWidget         *widget,
-                                                                 GtkOrientation     orientation,
-                                                                 gint              *minimum_size,
-                                                                 gint              *natural_size,
-                                                                 gint              *allocated_pos,
-                                                                 gint              *allocated_size);
-static void             gtk_widget_real_adjust_baseline_allocation (GtkWidget         *widget,
-                                                                   gint              *baseline);
+static void             gtk_widget_adjust_baseline_allocation (GtkWidget         *widget,
+                                                               gint              *baseline);
 
 static void                  template_data_free                 (GtkWidgetTemplate    *template_data);
 
@@ -1084,10 +1071,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   klass->priv->accessible_role = ATK_ROLE_INVALID;
   klass->get_accessible = gtk_widget_real_get_accessible;
 
-  klass->adjust_size_request = gtk_widget_real_adjust_size_request;
-  klass->adjust_baseline_request = gtk_widget_real_adjust_baseline_request;
-  klass->adjust_size_allocation = gtk_widget_real_adjust_size_allocation;
-  klass->adjust_baseline_allocation = gtk_widget_real_adjust_baseline_allocation;
   klass->queue_draw_region = gtk_widget_real_queue_draw_region;
   klass->queue_draw_child = gtk_widget_real_queue_draw_child;
 
@@ -5468,21 +5451,20 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
 #endif
   /* Now that we have the right natural height and width, go ahead and remove any margins from the
    * allocated sizes and possibly limit them to the natural sizes */
-  GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
-                                                        GTK_ORIENTATION_HORIZONTAL,
-                                                        &dummy,
-                                                        &natural_width,
-                                                        &adjusted_allocation.x,
-                                                        &adjusted_allocation.width);
-  GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
-                                                        GTK_ORIENTATION_VERTICAL,
-                                                        &dummy,
-                                                        &natural_height,
-                                                        &adjusted_allocation.y,
-                                                        &adjusted_allocation.height);
+  gtk_widget_adjust_size_allocation (widget,
+                                     GTK_ORIENTATION_HORIZONTAL,
+                                     &dummy,
+                                     &natural_width,
+                                     &adjusted_allocation.x,
+                                     &adjusted_allocation.width);
+  gtk_widget_adjust_size_allocation (widget,
+                                     GTK_ORIENTATION_VERTICAL,
+                                     &dummy,
+                                     &natural_height,
+                                     &adjusted_allocation.y,
+                                     &adjusted_allocation.height);
   if (baseline >= 0)
-    GTK_WIDGET_GET_CLASS (widget)->adjust_baseline_allocation (widget,
-                                                              &baseline);
+    gtk_widget_adjust_baseline_allocation (widget, &baseline);
 
   if (adjusted_allocation.x < real_allocation.x ||
       adjusted_allocation.y < real_allocation.y ||
@@ -5861,13 +5843,13 @@ adjust_for_margin(gint               start_margin,
   *allocated_size -= (start_margin + end_margin);
 }
 
-static void
-gtk_widget_real_adjust_size_allocation (GtkWidget         *widget,
-                                        GtkOrientation     orientation,
-                                        gint              *minimum_size,
-                                        gint              *natural_size,
-                                        gint              *allocated_pos,
-                                        gint              *allocated_size)
+void
+gtk_widget_adjust_size_allocation (GtkWidget         *widget,
+                                   GtkOrientation     orientation,
+                                   gint              *minimum_size,
+                                   gint              *natural_size,
+                                   gint              *allocated_pos,
+                                   gint              *allocated_size)
 {
   GtkWidgetPrivate *priv = widget->priv;
 
@@ -5892,8 +5874,8 @@ gtk_widget_real_adjust_size_allocation (GtkWidget         *widget,
 }
 
 static void
-gtk_widget_real_adjust_baseline_allocation (GtkWidget *widget,
-                                           gint      *baseline)
+gtk_widget_adjust_baseline_allocation (GtkWidget *widget,
+                                       gint      *baseline)
 {
   if (*baseline >= 0)
     *baseline -= widget->priv->margin.top;
@@ -10860,11 +10842,11 @@ gtk_widget_real_unrealize (GtkWidget *widget)
   gtk_widget_set_realized (widget, FALSE);
 }
 
-static void
-gtk_widget_real_adjust_size_request (GtkWidget      *widget,
-                                     GtkOrientation  orientation,
-                                     gint           *minimum_size,
-                                     gint           *natural_size)
+void
+gtk_widget_adjust_size_request (GtkWidget      *widget,
+                                GtkOrientation  orientation,
+                                gint           *minimum_size,
+                                gint           *natural_size)
 {
   GtkWidgetPrivate *priv = widget->priv;
 
@@ -10891,10 +10873,10 @@ gtk_widget_real_adjust_size_request (GtkWidget      *widget,
     }
 }
 
-static void
-gtk_widget_real_adjust_baseline_request (GtkWidget *widget,
-                                        gint      *minimum_baseline,
-                                        gint      *natural_baseline)
+void
+gtk_widget_adjust_baseline_request (GtkWidget *widget,
+                                    gint      *minimum_baseline,
+                                    gint      *natural_baseline)
 {
   GtkWidgetPrivate *priv = widget->priv;
 
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index c05d5fd..97dce2c 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -275,41 +275,9 @@ struct _GtkWidget
  *   widget; or emitted when widget got focus in keyboard mode.
  * @compute_expand: Computes whether a container should give this
  *   widget extra space when possible.
- * @adjust_size_request: Convert an initial size request from a widget's
- *   #GtkSizeRequestMode virtual method implementations into a size request to
- *   be used by parent containers in laying out the widget.
- *   adjust_size_request adjusts from a child widget's
- *   original request to what a parent container should
- *   use for layout. The @for_size argument will be -1 if the request should
- *   not be for a particular size in the opposing orientation, i.e. if the
- *   request is not height-for-width or width-for-height. If @for_size is
- *   greater than -1, it is the proposed allocation in the opposing
- *   orientation that we need the request for. Implementations of
- *   adjust_size_request should chain up to the default implementation,
- *   which applies #GtkWidget’s margin properties and imposes any values
- *   from gtk_widget_set_size_request(). Chaining up should be last,
- *   after your subclass adjusts the request, so
- *   #GtkWidget can apply constraints and add the margin properly.
- * @adjust_size_allocation: Convert an initial size allocation assigned
- *   by a #GtkContainer using gtk_widget_size_allocate(), into an actual
- *   size allocation to be used by the widget. adjust_size_allocation
- *   adjusts to a child widget’s actual allocation
- *   from what a parent container computed for the
- *   child. The adjusted allocation must be entirely within the original
- *   allocation. In any custom implementation, chain up to the default
- *   #GtkWidget implementation of this method, which applies the margin
- *   and alignment properties of #GtkWidget. Chain up
- *   before performing your own adjustments so your
- *   own adjustments remove more allocation after the #GtkWidget base
- *   class has already removed margin and alignment. The natural size
- *   passed in should be adjusted in the same way as the allocated size,
- *   which allows adjustments to perform alignments or other changes
- *   based on natural size.
  * @style_updated: Signal emitted when the GtkStyleContext of a widget
  *   is changed.
  * @touch_event:
- * @adjust_baseline_request:
- * @adjust_baseline_allocation:
  * @queue_draw_region: Invalidates the area of widget defined by
  *   region.
  * @queue_draw_child: Child wants to be redrawn. The region given is in
@@ -501,27 +469,11 @@ struct _GtkWidgetClass
                                        gboolean   *hexpand_p,
                                        gboolean   *vexpand_p);
 
-  void         (* adjust_size_request)    (GtkWidget         *widget,
-                                           GtkOrientation     orientation,
-                                           gint              *minimum_size,
-                                           gint              *natural_size);
-  void         (* adjust_size_allocation) (GtkWidget         *widget,
-                                           GtkOrientation     orientation,
-                                           gint              *minimum_size,
-                                           gint              *natural_size,
-                                           gint              *allocated_pos,
-                                           gint              *allocated_size);
-
   void         (* style_updated)          (GtkWidget *widget);
 
   gboolean     (* touch_event)            (GtkWidget     *widget,
                                            GdkEventTouch *event);
 
-  void         (* adjust_baseline_request)(GtkWidget         *widget,
-                                           gint              *minimum_baseline,
-                                           gint              *natural_baseline);
-  void         (* adjust_baseline_allocation) (GtkWidget             *widget,
-                                              gint                  *baseline);
   void         (* queue_draw_region)           (GtkWidget            *widget,
                                                const cairo_region_t *region);
   void         (* queue_draw_child)            (GtkWidget            *widget,
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 6ffa5c4..c930640 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -290,6 +290,21 @@ void              gtk_widget_snapshot_child                (GtkWidget
                                                             GtkWidget            *child,
                                                             GtkSnapshot          *snapshot);
 
+void              gtk_widget_adjust_size_request           (GtkWidget      *widget,
+                                                            GtkOrientation  orientation,
+                                                            gint           *minimum_size,
+                                                            gint           *natural_size);
+void              gtk_widget_adjust_size_allocation        (GtkWidget         *widget,
+                                                            GtkOrientation     orientation,
+                                                            gint              *minimum_size,
+                                                            gint              *natural_size,
+                                                            gint              *allocated_pos,
+                                                            gint              *allocated_size);
+void              gtk_widget_adjust_baseline_request       (GtkWidget *widget,
+                                                            gint      *minimum_baseline,
+                                                            gint      *natural_baseline);
+
+
 
 /* inline getters */
 


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