diff options
author | Timm Bäder <mail@baedert.org> | 2017-07-11 09:58:21 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:16 -0400 |
commit | 36ab70ddf5dbe993eb995bd9157f347258765922 (patch) | |
tree | 508f0ca9cf6b4fc990e88b0a5892b50f594890fe /gtk/gtkbbox.c | |
parent | 95bd58ac00ede771ca80684e143fffdc61ff2194 (diff) | |
download | gtk+-36ab70ddf5dbe993eb995bd9157f347258765922.tar.gz |
widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.
This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
Diffstat (limited to 'gtk/gtkbbox.c')
-rw-r--r-- | gtk/gtkbbox.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index f35f67e23b..2661001935 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -97,8 +97,10 @@ static void gtk_button_box_measure (GtkWidget *widget, int *natural, int *minimum_baseline, int *natural_baseline); -static void gtk_button_box_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void gtk_button_box_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip); static void gtk_button_box_remove (GtkContainer *container, GtkWidget *widget); static void gtk_button_box_set_child_property (GtkContainer *container, @@ -742,8 +744,10 @@ gtk_button_box_measure (GtkWidget *widget, } static void -gtk_button_box_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +gtk_button_box_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip) { GtkButtonBox *bbox = GTK_BUTTON_BOX (widget); GtkButtonBoxPrivate *priv = bbox->priv; @@ -769,15 +773,16 @@ gtk_button_box_size_allocate (GtkWidget *widget, gint secondary_size; gint total_size; gint baseline_height; - gint baseline; gint child_baseline; gint i; - GtkAllocation clip = *allocation; GdkRectangle child_clip; if (priv->layout_style == GTK_BUTTONBOX_EXPAND) { - GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, allocation); + GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, + allocation, + baseline, + out_clip); return; } @@ -1029,9 +1034,8 @@ gtk_button_box_size_allocate (GtkWidget *widget, } } - gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline); - gtk_widget_get_clip (child, &child_clip); - gdk_rectangle_union (&clip, &child_clip, &clip); + gtk_widget_size_allocate (child, &child_allocation, child_baseline, &child_clip); + gdk_rectangle_union (out_clip, &child_clip, out_clip); i++; } } @@ -1040,8 +1044,6 @@ gtk_button_box_size_allocate (GtkWidget *widget, g_free (widths); g_free (heights); g_free (baselines); - - gtk_widget_set_clip (widget, &clip); } /** |