[gnome-shell] popupMenu: Overwrite ongoing animations when calling close repeatedly



commit 98b313c75fcbb08c5ada3d2088b59ec00b9d4aab
Author: Florian MÃllner <fmuellner gnome org>
Date:   Fri Oct 19 23:13:16 2012 +0200

    popupMenu: Overwrite ongoing animations when calling close repeatedly
    
    Currently close() is a no-op when the menu has already been closed.
    However, repeated calls could pass different animation parameters.
    For instance in the user menu, we try to hide the menu immediately
    before locking the screen, to avoid the popup jumping across the
    screen while fading out - as we do this from the corresponding
    item's activate handler, the closing is still animated if the menu's
    own handler (which requests a full animation) is run first.
    Fix this by changing close() to overwrite ongoing animations before
    bailing out early.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686484

 js/ui/boxpointer.js |    1 +
 js/ui/popupMenu.js  |    9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 5435002..01bc2c8 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -141,6 +141,7 @@ const BoxPointer = new Lang.Class({
 
         this._muteInput();
 
+        Tweener.removeTweens(this);
         Tweener.addTween(this, { opacity: fade ? 0 : 255,
                                  xOffset: xOffset,
                                  yOffset: yOffset,
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 23368a5..a469388 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1269,13 +1269,14 @@ const PopupMenu = new Lang.Class({
     },
 
     close: function(animate) {
-        if (!this.isOpen)
-            return;
-
         if (this._activeMenuItem)
             this._activeMenuItem.setActive(false);
 
-        this._boxPointer.hide(animate);
+        if (this._boxPointer.actor.visible)
+            this._boxPointer.hide(animate);
+
+        if (!this.isOpen)
+            return;
 
         this.isOpen = false;
         this.emit('open-state-changed', false);



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