[clutter] actor: Use fixed positioning for allocate_preferred_size



commit 15b811840c81a990ff0d09eba05952fd34277c63
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 29 18:36:10 2012 -0500

    actor: Use fixed positioning for allocate_preferred_size
    
    clutter_actor_allocate_preferred_size is supposed to use the fixed
    position of an actor. Unfortunately, recent refactorings made it so
    that it accidentally used the current allocation. As the current
    allocation may be adjusted by the actor, or have been previously
    allocated in a strange spot, it may have unintended side effects. Use
    the fixed positioning of the actor instead.
    
    This fixes weird issues with margins colliding with
    ClutterFixedLayout, causing strange offsets on relayout.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689316

 clutter/clutter-actor.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 2f24de0..55861bb 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -15097,11 +15097,24 @@ clutter_actor_allocate_preferred_size (ClutterActor           *self,
   gfloat actor_x, actor_y;
   gfloat natural_width, natural_height;
   ClutterActorBox actor_box;
+  ClutterActorPrivate *priv;
+  const ClutterLayoutInfo *info;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
-  actor_x = clutter_actor_get_x (self);
-  actor_y = clutter_actor_get_y (self);
+  priv = self->priv;
+
+  if (priv->position_set)
+    {
+      info = _clutter_actor_get_layout_info_or_defaults (self);
+      actor_x = info->fixed_pos.x;
+      actor_y = info->fixed_pos.y;
+    }
+  else
+    {
+      actor_x = 0;
+      actor_y = 0;
+    }
 
   clutter_actor_get_preferred_size (self,
                                     NULL, NULL,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]