[clutter] Ensure that fixed positions always start at 0,0



commit fd8dcfcc565f1f3130cbd1c1b59a870bda26d518
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 7 16:32:01 2012 +0200

    Ensure that fixed positions always start at 0,0
    
    Fixed positions are defined to be initialized at 0,0 whenever
    enabled, by setting fixed_position_enabled to true, or by setting
    just one of x/y. This normally happens in the defaults, but we need
    to make sure it also happens if a fixed position was once set but
    then disabled. We do this by always resetting it back to 0,0 when
    fixed_position_set is unset.

 clutter/clutter-actor.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 96d3de2..c5b4107 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -9120,6 +9120,20 @@ clutter_actor_set_fixed_position_set (ClutterActor *self,
   if (self->priv->position_set == (is_set != FALSE))
     return;
 
+  if (!is_set)
+    {
+      ClutterLayoutInfo *info;
+
+      /* Ensure we set back the default fixed position of 0,0 so that setting
+	 just one of x/y always atomically gets 0 for the other */
+      info = _clutter_actor_peek_layout_info (self);
+      if (info != NULL)
+	{
+	  info->fixed_pos.x = 0;
+	  info->fixed_pos.y = 0;
+	}
+    }
+
   self->priv->position_set = is_set != FALSE;
   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FIXED_POSITION_SET]);
 



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