From 50f6b2ac2cd2612627c7b728befd3553f46cf2f6 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 19 Feb 2013 22:15:52 -0500 Subject: [PATCH] actor: Fix clutter_actor_allocate_align_fill for partially-filled actors If we pass TRUE for x_align and FALSE for y_align, the full available width should be passed to clutter_get_preferred_height, and the same should be true in the other dimension. https://bugzilla.gnome.org/show_bug.cgi?id=694237 --- clutter/clutter-actor.c | 46 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 1d87837e2..09fa4424b 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -15205,34 +15205,32 @@ clutter_actor_allocate_align_fill (ClutterActor *self, if (available_height < 0) available_height = 0; + allocation.x1 = x_offset; + allocation.y1 = y_offset; + if (x_fill) - { - allocation.x1 = x_offset; - allocation.x2 = allocation.x1 + available_width; - } + child_width = available_width; if (y_fill) - { - allocation.y1 = y_offset; - allocation.y2 = allocation.y1 + available_height; - } + child_height = available_height; /* if we are filling horizontally and vertically then we're done */ if (x_fill && y_fill) goto out; - child_width = child_height = 0.0f; - if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH) { gfloat min_width, natural_width; gfloat min_height, natural_height; - clutter_actor_get_preferred_width (self, available_height, - &min_width, - &natural_width); + if (!x_fill) + { + clutter_actor_get_preferred_width (self, available_height, + &min_width, + &natural_width); - child_width = CLAMP (natural_width, min_width, available_width); + child_width = CLAMP (natural_width, min_width, available_width); + } if (!y_fill) { @@ -15248,11 +15246,14 @@ clutter_actor_allocate_align_fill (ClutterActor *self, gfloat min_width, natural_width; gfloat min_height, natural_height; - clutter_actor_get_preferred_height (self, available_width, - &min_height, - &natural_height); + if (!y_fill) + { + clutter_actor_get_preferred_height (self, available_width, + &min_height, + &natural_height); - child_height = CLAMP (natural_height, min_height, available_height); + child_height = CLAMP (natural_height, min_height, available_height); + } if (!x_fill) { @@ -15270,23 +15271,18 @@ clutter_actor_allocate_align_fill (ClutterActor *self, if (!x_fill) { - allocation.x1 = x_offset - + ((available_width - child_width) * x_align); + allocation.x1 += ((available_width - child_width) * x_align); allocation.x2 = allocation.x1 + child_width; } if (!y_fill) { - allocation.y1 = y_offset - + ((available_height - child_height) * y_align); + allocation.y1 += ((available_height - child_height) * y_align); allocation.y2 = allocation.y1 + child_height; } out: - child_width = allocation.x2 - allocation.x1; - child_height = allocation.y2 - allocation.y1; - allocation.x1 = floorf (allocation.x1); allocation.y1 = floorf (allocation.y1); allocation.x2 = ceilf (allocation.x1 + child_width);