animation: Add (integer) geometry scaling support to Spinner

Until now it only supported (float) fractional scaling.

Since the SpinnerContent requires a Clutter size in logical pixels,
we need to specify that at map time when the scaling factor is known.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8126
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3634>
This commit is contained in:
Daniel van Vugt 2025-02-10 16:04:18 +08:00
parent 4f5cd433b2
commit c9cd4fbcd0

View File

@ -15,16 +15,22 @@ class Spinner extends St.Widget {
hideOnStop: false,
});
super({
width: size,
height: size,
opacity: 0,
});
this._size = size;
this._animate = params.animate;
this._hideOnStop = params.hideOnStop;
this.visible = !this._hideOnStop;
}
vfunc_map() {
const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage);
const logicalSize = this._size * scaleFactor;
this.set_size(logicalSize, logicalSize);
super.vfunc_map();
}
play() {
this.remove_all_transitions();
this.set_content(new St.SpinnerContent());