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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3023>
This commit is contained in:
Julian Sparber 2023-11-21 11:29:46 +01:00
parent 78eb5f2a68
commit 5b8347f90b

View File

@ -309,32 +309,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);
}
}