appDisplay: Don't start animation from the 'paint' signal
Starting the animation from the actor 'paint' signal has various unwanted consequences, such as sometimes trigger a clutter_actor_queue_relayout() during the paint phase. One unwanted consequence was that an offscreen actor effect was disabled during painting, meaning the effect would begin being active, but later during the post-paint processing being disabled. The caused said effect to push an offscreen framebuffer to the paint context, but then just destroy it instead of popping it. When this happened, we'd end up trying to operate on a framebuffer that may had been finalized, or not, depending on the garbage collector. Sometimes, for some users, this caused a segmentation fault when trying to pop a matrix from the framebuffer matrix stack. Deal with this more properly, by using the 'view-loaded' signal to wait with animation until the view is loaded, as well as using MetaLater to schedule the start of the animation. For when a view was signalled to be ready, we're in a state where we can start animation before the next frame as the layout is ready, but when not, we have to add back the "hack" where we must wait for one frame for the target icon positions to be up to date. Do this by adding a MetaLater IDLE callback that starts the animation *after* the next frame. This also needs the old 'opacity = 0' work around to not show an incorrect first frame. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2418 https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1154
This commit is contained in:
parent
4f427f4e0d
commit
5c33fe4a0a
@ -192,6 +192,9 @@ var BaseAppView = GObject.registerClass({
|
|||||||
this._items.set(icon.id, icon);
|
this._items.set(icon.id, icon);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._animateLaterId = 0;
|
||||||
|
this._viewLoadedHandlerId = 0;
|
||||||
|
this._viewIsReady = true;
|
||||||
this.emit('view-loaded');
|
this.emit('view-loaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,6 +244,18 @@ var BaseAppView = GObject.registerClass({
|
|||||||
Main.overview.dash.showAppsButton);
|
Main.overview.dash.showAppsButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clearAnimateLater() {
|
||||||
|
if (this._animateLaterId) {
|
||||||
|
Meta.later_remove(this._animateLaterId);
|
||||||
|
this._animateLaterId = 0;
|
||||||
|
}
|
||||||
|
if (this._viewLoadedHandlerId) {
|
||||||
|
this.disconnect(this._viewLoadedHandlerId);
|
||||||
|
this._viewLoadedHandlerId = 0;
|
||||||
|
}
|
||||||
|
this._grid.opacity = 255;
|
||||||
|
}
|
||||||
|
|
||||||
animate(animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
let animationDoneId = this._grid.connect('animation-done', () => {
|
let animationDoneId = this._grid.connect('animation-done', () => {
|
||||||
@ -249,11 +264,28 @@ var BaseAppView = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._clearAnimateLater();
|
||||||
|
|
||||||
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
||||||
let id = this._grid.connect('paint', () => {
|
const doSpringAnimationLater = laterType => {
|
||||||
this._grid.disconnect(id);
|
this._animateLaterId = Meta.later_add(laterType,
|
||||||
this._doSpringAnimation(animationDirection);
|
() => {
|
||||||
});
|
this._animateLaterId = 0;
|
||||||
|
this._doSpringAnimation(animationDirection);
|
||||||
|
return GLib.SOURCE_REMOVE;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this._viewIsReady) {
|
||||||
|
this._grid.opacity = 0;
|
||||||
|
doSpringAnimationLater(Meta.LaterType.IDLE);
|
||||||
|
} else {
|
||||||
|
this._viewLoadedHandlerId = this.connect('view-loaded',
|
||||||
|
() => {
|
||||||
|
this._clearAnimateLater();
|
||||||
|
doSpringAnimationLater(Meta.LaterType.BEFORE_REDRAW);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this._doSpringAnimation(animationDirection);
|
this._doSpringAnimation(animationDirection);
|
||||||
}
|
}
|
||||||
@ -375,15 +407,19 @@ var AllView = GObject.registerClass({
|
|||||||
this._lastOvershootY = -1;
|
this._lastOvershootY = -1;
|
||||||
this._lastOvershootTimeoutId = 0;
|
this._lastOvershootTimeoutId = 0;
|
||||||
|
|
||||||
|
this._viewIsReady = false;
|
||||||
|
|
||||||
Main.overview.connect('hidden', () => this.goToPage(0));
|
Main.overview.connect('hidden', () => this.goToPage(0));
|
||||||
|
|
||||||
this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this));
|
this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this));
|
||||||
|
|
||||||
Shell.AppSystem.get_default().connect('installed-changed', () => {
|
Shell.AppSystem.get_default().connect('installed-changed', () => {
|
||||||
|
this._viewIsReady = false;
|
||||||
Main.queueDeferredWork(this._redisplayWorkId);
|
Main.queueDeferredWork(this._redisplayWorkId);
|
||||||
});
|
});
|
||||||
this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' });
|
this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' });
|
||||||
this._folderSettings.connect('changed::folder-children', () => {
|
this._folderSettings.connect('changed::folder-children', () => {
|
||||||
|
this._viewIsReady = false;
|
||||||
Main.queueDeferredWork(this._redisplayWorkId);
|
Main.queueDeferredWork(this._redisplayWorkId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user