pageIndicators: Defer IN animation until redraw

Unlike Tweener, which doesn't know or care about actor state, Clutter
will skip implicit animations on actors that aren't mapped. This makes
sense of course, but it will break the page indicator animation we
do on map: When we get notified about the container being mapped, the
individual indicators (which are the actors being animated) are still
unmapped.

Resolve this by deferring the animation to a LaterFunc.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
This commit is contained in:
Florian Müllner 2019-08-05 01:02:38 +02:00
parent 5d6db923b7
commit 870dd84a50

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported PageIndicators, AnimatedPageIndicators */ /* exported PageIndicators, AnimatedPageIndicators */
const { Clutter, GObject, St } = imports.gi; const { Clutter, GLib, GObject, Meta, St } = imports.gi;
const Tweener = imports.ui.tweener; const Tweener = imports.ui.tweener;
const { ANIMATION_TIME_OUT, ANIMATION_MAX_DELAY_OUT_FOR_ITEM, AnimationDirection } = imports.ui.iconGrid; const { ANIMATION_TIME_OUT, ANIMATION_MAX_DELAY_OUT_FOR_ITEM, AnimationDirection } = imports.ui.iconGrid;
@ -97,7 +97,15 @@ class AnimatedPageIndicators extends PageIndicators {
super._init(true); super._init(true);
this.connect('notify::mapped', () => { this.connect('notify::mapped', () => {
if (!this.mapped)
return;
// Implicit animations are skipped for unmapped actors, and our
// children aren't mapped yet, so defer to a later handler
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this.animateIndicators(AnimationDirection.IN); this.animateIndicators(AnimationDirection.IN);
return GLib.SOURCE_REMOVE;
});
}); });
} }