From e8cdf361a48337428c4a863c4d0ccb5ee68e313a Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Tue, 21 Nov 2023 11:29:46 +0100 Subject: [PATCH] st/viewport: Set adjustment properties all at once This ensures that that property changes are notified all at the same time and only after all were set. If we notify too early handlers may act on a "broken" viewport. Part-of: (cherry picked from commit 5b8347f90beed97e371a2d3b18dea99a8deeabb0) --- src/st/st-viewport.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/st/st-viewport.c b/src/st/st-viewport.c index e6b912766..11a080d04 100644 --- a/src/st/st-viewport.c +++ b/src/st/st-viewport.c @@ -310,32 +310,30 @@ st_viewport_allocate (ClutterActor *actor, { double prev_value; - g_object_set (G_OBJECT (priv->vadjustment), - "lower", 0.0, - "upper", MAX (min_height, avail_height), - "page-size", avail_height, - "step-increment", avail_height / 6, - "page-increment", avail_height - avail_height / 6, - NULL); - prev_value = st_adjustment_get_value (priv->vadjustment); - st_adjustment_set_value (priv->vadjustment, prev_value); + + st_adjustment_set_values (priv->vadjustment, + prev_value, + 0.0, + MAX (min_height, avail_height), + avail_height / 6, + avail_height - avail_height / 6, + avail_height); } if (priv->hadjustment) { double prev_value; - g_object_set (G_OBJECT (priv->hadjustment), - "lower", 0.0, - "upper", MAX (min_width, avail_width), - "page-size", avail_width, - "step-increment", avail_width / 6, - "page-increment", avail_width - avail_width / 6, - NULL); - prev_value = st_adjustment_get_value (priv->hadjustment); - st_adjustment_set_value (priv->hadjustment, prev_value); + + st_adjustment_set_values (priv->hadjustment, + prev_value, + 0.0, + MAX (min_width, avail_width), + avail_width / 6, + avail_width - avail_width / 6, + avail_width); } }