[gnome-shell] Overview: Remove invisible animations



commit 7279cc1db861c996949d60d295cc4749289685ca
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Thu Dec 16 20:21:12 2010 +0100

    Overview: Remove invisible animations
    
    Given that the grid view is gone there is no point in animating the
    window previews on all workspaces anymore so just do it for the current
    one avoid taking a slow down caused by animating windows on other workspaces.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=637353

 js/ui/workspace.js |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 0f53380..6002492 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -396,7 +396,7 @@ WindowOverlay.prototype = {
     // These parameters are not the values retrieved with
     // get_transformed_position() and get_transformed_size(),
     // as windowClone might be moving.
-    // See Workspace._fadeInWindowOverlay
+    // See Workspace._showWindowOverlay
     updatePositions: function(cloneX, cloneY, cloneWidth, cloneHeight) {
         let button = this.closeButton;
         let title = this.title;
@@ -946,6 +946,9 @@ Workspace.prototype = {
         let slots = this._computeAllWindowSlots(visibleClones.length);
         visibleClones = this._orderWindowsByMotionAndStartup(visibleClones, slots);
 
+        let currentWorkspace = global.screen.get_active_workspace();
+        let isOnCurrentWorkspace = this.metaWorkspace == currentWorkspace;
+
         for (let i = 0; i < visibleClones.length; i++) {
             let slot = slots[i];
             let clone = visibleClones[i];
@@ -962,7 +965,7 @@ Workspace.prototype = {
 
             if (overlay)
                 overlay.hide();
-            if (animate) {
+            if (animate && isOnCurrentWorkspace) {
                 if (!metaWindow.showing_on_its_workspace()) {
                     /* Hidden windows should fade in and grow
                      * therefore we need to resize them now so they
@@ -992,13 +995,13 @@ Workspace.prototype = {
                                    time: Overview.ANIMATION_TIME,
                                    transition: 'easeOutQuad',
                                    onComplete: Lang.bind(this, function() {
-                                      this._fadeInWindowOverlay(clone, overlay);
+                                      this._showWindowOverlay(clone, overlay, true);
                                    })
                                  });
             } else {
                 clone.actor.set_position(x, y);
                 clone.actor.set_scale(scale, scale);
-                this._fadeInWindowOverlay(clone, overlay);
+                this._showWindowOverlay(clone, overlay, isOnCurrentWorkspace);
             }
         }
     },
@@ -1019,7 +1022,7 @@ Workspace.prototype = {
         }
     },
 
-    _fadeInWindowOverlay: function(clone, overlay) {
+    _showWindowOverlay: function(clone, overlay, fade) {
         if (clone.inDrag)
             return;
 
@@ -1041,17 +1044,21 @@ Workspace.prototype = {
 
         if (overlay) {
             overlay.updatePositions(cloneX, cloneY, cloneWidth, cloneHeight);
-            overlay.fadeIn();
+            if (fade)
+                overlay.fadeIn();
+            else
+                overlay.show();
         }
     },
 
-    _fadeInAllOverlays: function() {
+    _showAllOverlays: function() {
+        let currentWorkspace = global.screen.get_active_workspace();
         for (let i = 0; i < this._windows.length; i++) {
             let clone = this._windows[i];
             let overlay = this._windowOverlays[i];
             if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows))
                 continue;
-            this._fadeInWindowOverlay(clone, overlay);
+            this._showWindowOverlay(clone, overlay, this.metaWorkspace == currentWorkspace);
         }
     },
 
@@ -1087,7 +1094,7 @@ Workspace.prototype = {
 
     showWindowsOverlays: function() {
         this._windowOverlaysGroup.show();
-        this._fadeInAllOverlays();
+        this._showAllOverlays();
     },
 
     hideWindowsOverlays: function() {
@@ -1208,6 +1215,8 @@ Workspace.prototype = {
 
     // Animates the return from Overview mode
     zoomFromOverview : function() {
+        let currentWorkspace = global.screen.get_active_workspace();
+
         this.leavingOverview = true;
 
         this._hideAllOverlays();
@@ -1219,6 +1228,9 @@ Workspace.prototype = {
         this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
                                                                            this._doneLeavingOverview));
 
+        if (this._metaWorkspace == currentWorkspace)
+            return;
+
         // Position and scale the windows.
         for (let i = 0; i < this._windows.length; i++) {
             let clone = this._windows[i];



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