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/gtklevelbar.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/gtklevelbar.c')
-rw-r--r-- | gtk/gtklevelbar.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c index 969fe47e4b..523b1f3790 100644 --- a/gtk/gtklevelbar.c +++ b/gtk/gtklevelbar.c @@ -436,10 +436,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self, /* allocate the empty (unfilled) part */ block_area = *allocation; - gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 0 : 1], - &block_area, - baseline); - gtk_widget_get_clip (self->priv->block_widget[inverted ? 0 : 1], out_clip); + gtk_widget_size_allocate (self->priv->block_widget[inverted ? 0 : 1], + &block_area, + baseline, + out_clip); /* now allocate the filled part */ block_area = *allocation; @@ -466,10 +466,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self, block_area.y += allocation->height - block_area.height; } - gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 1 : 0], - &block_area, - baseline); - gtk_widget_get_clip (self->priv->block_widget[inverted ? 1 : 0], &clip); + gtk_widget_size_allocate (self->priv->block_widget[inverted ? 1 : 0], + &block_area, + baseline, + &clip); gdk_rectangle_intersect (out_clip, &clip, out_clip); } @@ -507,10 +507,10 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self, for (i = 0; i < num_blocks; i++) { - gtk_widget_size_allocate_with_baseline (self->priv->block_widget[i], - &block_area, - baseline); - gtk_widget_get_clip (self->priv->block_widget[i], &clip); + gtk_widget_size_allocate (self->priv->block_widget[i], + &block_area, + baseline, + &clip); gdk_rectangle_intersect (out_clip, &clip, out_clip); if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL) @@ -536,16 +536,14 @@ gtk_level_bar_allocate_trough (GtkGizmo *gizmo, } static void -gtk_level_bar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) +gtk_level_bar_size_allocate (GtkWidget *widget, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip) { GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget)); - GtkAllocation clip = *allocation; - gtk_widget_size_allocate (priv->trough_widget, allocation); - gtk_widget_get_clip (priv->trough_widget, &clip); - - gtk_widget_set_clip (widget, &clip); + gtk_widget_size_allocate (priv->trough_widget, allocation, baseline, out_clip); } static void |