iconGrid: Delay updating adjustment value on page switch

When switching to a newly created page, the adjustment's limits
haven't been adjusted yet. As a result, setting the new value
only works when the transition is animated.

To fix the non-animated case, use a MetaLater to set the adjustment
value.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6315

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2670>
This commit is contained in:
Florian Müllner 2023-03-01 20:39:00 +01:00
parent c676bc04f9
commit 7ada79f6d9

View File

@ -1349,10 +1349,14 @@ var IconGrid = GObject.registerClass({
if (!this.mapped)
animate = false;
adjustment.ease(newValue, {
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
duration: animate ? PAGE_SWITCH_TIME : 0,
});
global.compositor.get_laters().add(
Meta.LaterType.BEFORE_REDRAW, () => {
adjustment.ease(newValue, {
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
duration: animate ? PAGE_SWITCH_TIME : 0,
});
return GLib.SOURCE_REMOVE;
});
}
/**