summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-02-19 22:15:52 -0500
committerEmmanuele Bassi <ebassi@gnome.org>2013-03-04 23:14:12 +0000
commitfca748c2f52a348e88dc5661d8087a438b1697e6 (patch)
treed8911be99d1ce6cc183cae5d03188e8d2d4cfb58
parent3360bcc0c3aa7469bc3407f880953e5ab816554b (diff)
downloadclutter-fca748c2f52a348e88dc5661d8087a438b1697e6.tar.gz
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 (cherry picked from commit 50f6b2ac2cd2612627c7b728befd3553f46cf2f6) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-actor.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index be6ca9b41..fcfebfc95 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -15173,34 +15173,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)
{
@@ -15216,11 +15214,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)
{
@@ -15238,23 +15239,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);