[gnome-shell/wip/fmuellner/ease-actors: 14/20] pageIndicators: Defer IN animation until redraw



commit 5d013b860c5bce41f524f5abe337e4c2e362b614
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Aug 5 01:02:38 2019 +0200

    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

 js/ui/pageIndicators.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/pageIndicators.js b/js/ui/pageIndicators.js
index 05a535e75..c28e001e8 100644
--- a/js/ui/pageIndicators.js
+++ b/js/ui/pageIndicators.js
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported PageIndicators, AnimatedPageIndicators */
 
-const { Clutter, GObject, St } = imports.gi;
+const { Clutter, GLib, GObject, Meta, St } = imports.gi;
 
 const Tweener = imports.ui.tweener;
 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);
 
         this.connect('notify::mapped', () => {
-            this.animateIndicators(AnimationDirection.IN);
+            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);
+                return GLib.SOURCE_REMOVE;
+            });
         });
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]