[gnome-shell] workspaces-view: Simplify handling of removed workspaces



commit 45c1a9eafbfbc774408f4e12fe06afb87fb09bdf
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jun 1 04:23:12 2011 +0200

    workspaces-view: Simplify handling of removed workspaces
    
    Workspaces used to contain the desktop background, so when a
    workspace was removed, we animated its actor to an off-screen
    position before destroying it. As the background has been
    removed a while ago, we can destroy the actor directly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645031

 js/ui/workspace.js      |   10 ---------
 js/ui/workspacesView.js |   51 +++++-----------------------------------------
 2 files changed, 6 insertions(+), 55 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index bcffa5c..1650e7f 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -641,16 +641,6 @@ Workspace.prototype = {
         return this._windows.length == 0;
     },
 
-    /**
-     * setReactive:
-     * @reactive: %true iff the workspace should be reactive
-     *
-     * Set the workspace (desktop) reactive
-     **/
-    setReactive: function(reactive) {
-        this.actor.reactive = reactive;
-    },
-
     // Only use this for n <= 20 say
     _factorial: function(n) {
         let result = 1;
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index b25d638..05358a1 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -51,7 +51,6 @@ WorkspacesView.prototype = {
         this._y = 0;
         this._workspaceRatioSpacing = 0;
         this._spacing = 0;
-        this._lostWorkspaces = [];
         this._animating = false; // tweening
         this._scrolling = false; // swipe-scrolling
         this._animatingScroll = false; // programatically updating the adjustment
@@ -224,27 +223,6 @@ WorkspacesView.prototype = {
                     this._updateVisibility();
             }
         }
-
-        for (let l = 0; l < this._lostWorkspaces.length; l++) {
-            let workspace = this._lostWorkspaces[l];
-
-            Tweener.removeTweens(workspace.actor);
-
-            workspace.actor.show();
-            workspace.hideWindowsOverlays();
-
-            if (showAnimation) {
-                Tweener.addTween(workspace.actor,
-                                 { y: workspace.x,
-                                   time: WORKSPACE_SWITCH_TIME,
-                                   transition: 'easeOutQuad',
-                                   onComplete: Lang.bind(this,
-                                                         this._cleanWorkspaces)
-                                 });
-            } else {
-                this._cleanWorkspaces();
-            }
-        }
     },
 
     _updateVisibility: function() {
@@ -265,17 +243,6 @@ WorkspacesView.prototype = {
         }
     },
 
-    _cleanWorkspaces: function() {
-        if (this._lostWorkspaces.length == 0)
-            return;
-
-        for (let l = 0; l < this._lostWorkspaces.length; l++)
-            this._lostWorkspaces[l].destroy();
-        this._lostWorkspaces = [];
-
-        this._updateWorkspaceActors(false);
-    },
-
     _updateScrollAdjustment: function(index, showAnimation) {
         if (this._scrolling)
             return;
@@ -298,12 +265,9 @@ WorkspacesView.prototype = {
         }
     },
 
-    updateWorkspaces: function(oldNumWorkspaces, newNumWorkspaces, lostWorkspaces) {
+    updateWorkspaces: function(oldNumWorkspaces, newNumWorkspaces) {
         let active = global.screen.get_active_workspace_index();
 
-        for (let l = 0; l < lostWorkspaces.length; l++)
-            lostWorkspaces[l].disconnectAll();
-
         Tweener.addTween(this._scrollAdjustment,
                          { upper: newNumWorkspaces,
                            time: WORKSPACE_SWITCH_TIME,
@@ -315,8 +279,6 @@ WorkspacesView.prototype = {
                 this.actor.add_actor(this._workspaces[w].actor);
 
             this._updateWorkspaceActors(false);
-        } else {
-            this._lostWorkspaces = lostWorkspaces;
         }
 
         this._scrollToActive(true);
@@ -846,17 +808,16 @@ WorkspacesDisplay.prototype = {
             lostWorkspaces = this._workspaces.splice(removedIndex,
                                                      removedNum);
 
-            // Don't let the user try to select this workspace as it's
-            // making its exit.
-            for (let l = 0; l < lostWorkspaces.length; l++)
-                lostWorkspaces[l].setReactive(false);
+            for (let l = 0; l < lostWorkspaces.length; l++) {
+                lostWorkspaces[l].disconnectAll();
+                lostWorkspaces[l].destroy();
+            }
 
             this._thumbnailsBox.removeThumbmails(removedIndex, removedNum);
         }
 
         this.workspacesView.updateWorkspaces(oldNumWorkspaces,
-                                             newNumWorkspaces,
-                                             lostWorkspaces);
+                                             newNumWorkspaces);
     },
 
     _updateZoom : function() {



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