From 9f46258ff9937732f28a3f38ef1db6eb29b2fb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 22 Jun 2023 21:31:14 +0200 Subject: [PATCH] clutter/actor: Make sure expand_set flags are set correctly If an actor's expand properties haven't been set explicitly, its expand flags are computed by traversing its children. However we currently also traverse into children when explicitly setting "expand" to FALSE, because that is the default value and the properties are only marked as explicitly-set when the value actually changed. Fix this, so propagating expand flags can be stopped without hacks like ```c g_object_set (actor, "x-expand", TRUE, NULL); g_object_set (actor, "x-expand", FALSE, NULL); `` Part-of: --- clutter/clutter/clutter-actor.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index df98a8529..aa3baec38 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -18275,13 +18275,16 @@ clutter_actor_set_x_expand (ClutterActor *self, gboolean expand) { ClutterLayoutInfo *info; + gboolean changed; g_return_if_fail (CLUTTER_IS_ACTOR (self)); expand = !!expand; info = _clutter_actor_get_layout_info (self); - if (info->x_expand != expand) + changed = info->x_expand != expand; + + if (changed || !self->priv->x_expand_set) { info->x_expand = expand; @@ -18289,8 +18292,9 @@ clutter_actor_set_x_expand (ClutterActor *self, clutter_actor_queue_compute_expand (self); - g_object_notify_by_pspec (G_OBJECT (self), - obj_props[PROP_X_EXPAND]); + if (changed) + g_object_notify_by_pspec (G_OBJECT (self), + obj_props[PROP_X_EXPAND]); } } @@ -18330,13 +18334,16 @@ clutter_actor_set_y_expand (ClutterActor *self, gboolean expand) { ClutterLayoutInfo *info; + gboolean changed; g_return_if_fail (CLUTTER_IS_ACTOR (self)); expand = !!expand; info = _clutter_actor_get_layout_info (self); - if (info->y_expand != expand) + changed = info->y_expand != expand; + + if (changed || !self->priv->y_expand_set) { info->y_expand = expand; @@ -18344,8 +18351,9 @@ clutter_actor_set_y_expand (ClutterActor *self, clutter_actor_queue_compute_expand (self); - g_object_notify_by_pspec (G_OBJECT (self), - obj_props[PROP_Y_EXPAND]); + if (changed) + g_object_notify_by_pspec (G_OBJECT (self), + obj_props[PROP_Y_EXPAND]); } }