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.
This commit is contained in:
Alexander Larsson 2012-06-07 16:32:01 +02:00
parent 962bcb1222
commit fd8dcfcc56

View File

@ -9120,6 +9120,20 @@ clutter_actor_set_fixed_position_set (ClutterActor *self,
if (self->priv->position_set == (is_set != FALSE)) if (self->priv->position_set == (is_set != FALSE))
return; 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; self->priv->position_set = is_set != FALSE;
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FIXED_POSITION_SET]); g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FIXED_POSITION_SET]);