summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2014-12-13 14:29:30 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2015-01-09 11:51:02 +0000
commit35c126709f0066c0dd81cde30d4f776cad3f1177 (patch)
tree5d33b737e6a47f81ab3bf84be35c9f2a120973cf
parent735cdf2578b9abc4e914211adafc5e0e261eefe4 (diff)
downloadclutter-35c126709f0066c0dd81cde30d4f776cad3f1177.tar.gz
actor: Reset the content box when setting a new content
We want to recompute the content box when changing the content instance, in case the preferred size is different and the content gravity uses the preferred size; the change of content with different preferred size and same gravity should also trigger an implicit transition. https://bugzilla.gnome.org/show_bug.cgi?id=711182 (cherry picked from commit d546c0c121a967ab49773f91119dffe9d0358cdd) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-actor.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 01c33cbf5..8663a6ddb 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -19533,7 +19533,25 @@ clutter_actor_set_content (ClutterActor *self,
* do.
*/
if (priv->content_gravity != CLUTTER_CONTENT_GRAVITY_RESIZE_FILL)
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
+ {
+ if (priv->content_box_valid)
+ {
+ ClutterActorBox from_box, to_box;
+
+ clutter_actor_get_content_box (self, &from_box);
+
+ /* invalidate the cached content box */
+ priv->content_box_valid = FALSE;
+ clutter_actor_get_content_box (self, &to_box);
+
+ if (!clutter_actor_box_equal (&from_box, &to_box))
+ _clutter_actor_create_transition (self, obj_props[PROP_CONTENT_BOX],
+ &from_box,
+ &to_box);
+ }
+
+ g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
+ }
}
/**