Ensure that fixed positions always start at 0,0
authorAlexander Larsson <alexl@redhat.com>
Thu, 7 Jun 2012 14:32:01 +0000 (16:32 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 7 Jun 2012 14:32:01 +0000 (16:32 +0200)
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

index 96d3de2..c5b4107 100644 (file)
@@ -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]);