widget: Remove unused adjust_* vfuncs

Expose them privately to gtksizerequest.c using normal functions
instead.
This commit is contained in:
Timm Bäder
2016-11-23 17:46:44 +01:00
parent 1aa1676d9d
commit 489aee5d00
4 changed files with 61 additions and 118 deletions

View File

@@ -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,

View File

@@ -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);
@@ -1068,10 +1055,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;
@@ -5431,21 +5414,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 ||
@@ -5824,13 +5806,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;
@@ -5855,8 +5837,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;
@@ -10719,11 +10701,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;
@@ -10750,10 +10732,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;

View File

@@ -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 #GtkWidgets 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 widgets 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,

View File

@@ -282,6 +282,19 @@ void gtk_widget_render (GtkWidget
void gtk_widget_snapshot (GtkWidget *widget,
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 */