[gnome-shell] tweener: Remove the onAnimationStart/onAnimationComplete callbacks



commit 5bc8a0860a066bba1a1b2b11573e057a20da1a3f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Nov 9 11:00:39 2013 -0500

    tweener: Remove the onAnimationStart/onAnimationComplete callbacks
    
    Our gnome-shell tweener integration has had hooks to determine when
    the tweens have started and completed... except that they had a bug
    in them. When a tween completed, it queued an idle handler to run
    the callback in. If no tweens were running when the idle was removing,
    it reset the tween state that contained the idle handler ID. It also
    returned false, meaning that the source would always get removed.
    
    If the actor had a tween in-flight when the idle was fired, it wouldn't
    clean up after itself. While this is also a simple bug fix, remove the
    callback so we don't queue unnecessary, unused idles.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711732

 js/ui/tweener.js |   55 +++--------------------------------------------------
 1 files changed, 4 insertions(+), 51 deletions(-)
---
diff --git a/js/ui/tweener.js b/js/ui/tweener.js
index 65ea125..5765fe7 100644
--- a/js/ui/tweener.js
+++ b/js/ui/tweener.js
@@ -11,29 +11,8 @@ const Signals = imports.signals;
 const Tweener = imports.tweener.tweener;
 
 // This is a wrapper around imports.tweener.tweener that adds a bit of
-// Clutter integration and some additional callbacks:
-//
-//   1. If the tweening target is a Clutter.Actor, then the tweenings
-//      will automatically be removed if the actor is destroyed
-//
-//   2. If target._delegate.onAnimationStart() exists, it will be
-//      called when the target starts being animated.
-//
-//   3. If target._delegate.onAnimationComplete() exists, it will be
-//      called once the target is no longer being animated.
-//
-// The onAnimationStart() and onAnimationComplete() callbacks differ
-// from the tweener onStart and onComplete parameters, in that (1)
-// they track whether or not the target has *any* tweens attached to
-// it, as opposed to be called for *each* tween, and (2)
-// onAnimationComplete() is always called when the object stops being
-// animated, regardless of whether it stopped normally or abnormally.
-//
-// onAnimationComplete() is called at idle time, which means that if a
-// tween completes and then another is added before returning to the
-// main loop, the complete callback will not be called (until the new
-// tween finishes).
-
+// Clutter integration. If the tweening target is a Clutter.Actor, then
+// the tweenings will automatically be removed if the actor is destroyed.
 
 // ActionScript Tweener methods that imports.tweener.tweener doesn't
 // currently implement: getTweens, getVersion, registerTransition,
@@ -77,7 +56,6 @@ function _wrapTweening(target, tweeningParameters) {
     if (!Gtk.Settings.get_default().gtk_enable_animations)
         tweeningParameters['time'] = 0.000001;
 
-    _addHandler(target, tweeningParameters, 'onStart', _tweenStarted);
     _addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted);
 }
 
@@ -85,7 +63,7 @@ function _getTweenState(target) {
     // If we were paranoid, we could keep a plist mapping targets to
     // states... but we're not that paranoid.
     if (!target.__ShellTweenerState)
-        _resetTweenState(target);
+        target.__ShellTweenerState = {};
     return target.__ShellTweenerState;
 }
 
@@ -95,8 +73,6 @@ function _resetTweenState(target) {
     if (state) {
         if (state.destroyedId)
             state.actor.disconnect(state.destroyedId);
-        if (state.idleCompletedId)
-            Mainloop.source_remove(state.idleCompletedId);
     }
 
     target.__ShellTweenerState = {};
@@ -122,32 +98,9 @@ function _actorDestroyed(target) {
     Tweener.removeTweens(target);
 }
 
-function _tweenStarted(target) {
-    let state = _getTweenState(target);
-    let delegate = target._delegate;
-
-    if (!state.running && delegate && delegate.onAnimationStart)
-        delegate.onAnimationStart();
-    state.running = true;
-}
-
 function _tweenCompleted(target) {
-    let state = _getTweenState(target);
-
-    if (!state.idleCompletedId)
-        state.idleCompletedId = Mainloop.idle_add(Lang.bind(null, _idleCompleted, target));
-}
-
-function _idleCompleted(target) {
-    let state = _getTweenState(target);
-    let delegate = target._delegate;
-
-    if (!isTweening(target)) {
+    if (!isTweening(target))
         _resetTweenState(target);
-        if (delegate && delegate.onAnimationComplete)
-            delegate.onAnimationComplete();
-    }
-    return false;
 }
 
 function getTweenCount(scope) {


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