[gnome-shell] panel: prevent blink of current app indicator



commit 69d6ae41415b478abf6598fc80d40f4ade7064c9
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Tue Mar 8 20:46:43 2011 +0300

    panel: prevent blink of current app indicator
    
    If new current app is null, show animation of disappearing old.
    https://bugzilla.gnome.org/show_bug.cgi?id=615099

 js/ui/panel.js |   64 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 45 insertions(+), 19 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 3894539..c08c3e8 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -244,6 +244,10 @@ AppMenuButton.prototype = {
 
         let bin = new St.Bin({ name: 'appMenu' });
         this.actor.set_child(bin);
+
+        this.actor.reactive = false;
+        this._targetIsCurrent = false;
+
         this._container = new Shell.GenericContainer();
         bin.set_child(this._container);
         this._container.connect('get-preferred-width', Lang.bind(this, this._getContentPreferredWidth));
@@ -501,13 +505,6 @@ AppMenuButton.prototype = {
                 lastStartedApp = this._startingApps[i];
 
         let focusedApp = tracker.focus_app;
-        let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
-        if (targetApp == this._targetApp) {
-            if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
-                this.stopAnimation();
-            return;
-        }
-        this._stopAnimation();
 
         if (!focusedApp) {
             // If the app has just lost focus to the panel, pretend
@@ -517,27 +514,56 @@ AppMenuButton.prototype = {
                 return;
         }
 
+        let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
+
+        if (targetApp == null) {
+            if (!this._targetIsCurrent)
+                return;
+
+            this.actor.reactive = false;
+            this._targetIsCurrent = false;
+
+            Tweener.removeTweens(this.actor);
+            Tweener.addTween(this.actor, { opacity: 0,
+                                           time: Overview.ANIMATION_TIME,
+                                           transition: 'easeOutQuad' });
+            return;
+        }
+
+        if (!this._targetIsCurrent) {
+            this.actor.reactive = true;
+            this._targetIsCurrent = true;
+
+            Tweener.removeTweens(this.actor);
+            Tweener.addTween(this.actor, { opacity: 255,
+                                           time: Overview.ANIMATION_TIME,
+                                           transition: 'easeOutQuad' });
+        }
+
+        if (targetApp == this._targetApp) {
+            if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
+                this.stopAnimation();
+            return;
+        }
+        this._stopAnimation();
+
         if (this._iconBox.child != null)
             this._iconBox.child.destroy();
         this._iconBox.hide();
         this._label.setText('');
-        this.actor.reactive = false;
 
         this._targetApp = targetApp;
-        if (targetApp != null) {
-            let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
+        let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
 
-            this._label.setText(targetApp.get_name());
-            // TODO - _quit() doesn't really work on apps in state STARTING yet
-            this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
+        this._label.setText(targetApp.get_name());
+        // TODO - _quit() doesn't really work on apps in state STARTING yet
+        this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
 
-            this.actor.reactive = true;
-            this._iconBox.set_child(icon);
-            this._iconBox.show();
+        this._iconBox.set_child(icon);
+        this._iconBox.show();
 
-            if (targetApp.get_state() == Shell.AppState.STARTING)
-                this.startAnimation();
-        }
+        if (targetApp.get_state() == Shell.AppState.STARTING)
+            this.startAnimation();
 
         this.emit('changed');
     }



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