[gnome-shell] altTab: fix destroy-without-showing case



commit a46baeed0b51991d3bcaf0924c80dd6dfe5756ab
Author: Dan Winship <danw gnome org>
Date:   Thu Jan 6 13:38:41 2011 -0500

    altTab: fix destroy-without-showing case
    
    If the switcher is destroyed without ever being fully shown (either
    because it couldn't get a keyboard grab, or just because there are no
    apps to display), destroy it immediately rather than tweening it
    towards destruction, since its contents haven't been built yet and
    _allocate() will throw errors if it runs.

 js/ui/altTab.js |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index ca2b902..b117fc8 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -34,7 +34,8 @@ function AltTabPopup() {
 AltTabPopup.prototype = {
     _init : function() {
         this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
-                                                    reactive: true });
+                                                  reactive: true,
+                                                  visible: false });
 
         this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
         this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
@@ -365,15 +366,18 @@ AltTabPopup.prototype = {
     },
 
     destroy : function() {
-        Tweener.addTween(this.actor,
-                         { opacity: 0,
-                           time: POPUP_FADE_TIME,
-                           transition: 'easeOutQuad',
-                           onComplete: Lang.bind(this,
-                               function() {
-                                   this.actor.destroy();
-                               })
-                         });
+        if (this.actor.visible) {
+            Tweener.addTween(this.actor,
+                             { opacity: 0,
+                               time: POPUP_FADE_TIME,
+                               transition: 'easeOutQuad',
+                               onComplete: Lang.bind(this,
+                                   function() {
+                                       this.actor.destroy();
+                                   })
+                             });
+        } else
+            this.actor.destroy();
     },
 
     _onDestroy : function() {



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