[gnome-shell/overview-relayout: 5/20] linear-view: Remove NewWorkspaceArea



commit 95dc92b593ff9df79bf14ecf40b8d8382461cd30
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 4 20:04:23 2010 +0200

    linear-view: Remove NewWorkspaceArea
    
    As the button to add workspaces will move to the same position as
    the new workspace drop area in drag mode, the latter is redundant
    and can be removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634948

 js/ui/workspacesView.js |  106 ++++++++++-------------------------------------
 1 files changed, 22 insertions(+), 84 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 5a14279..5dd315e 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -472,32 +472,6 @@ MosaicView.prototype = {
     }
 };
 
-function NewWorkspaceArea() {
-    this._init();
-}
-
-NewWorkspaceArea.prototype = {
-    _init: function() {
-        let width = Math.ceil(global.screen_width * WORKSPACE_SHADOW_SCALE);
-        this.actor = new Clutter.Group({ width: width,
-                                         height: global.screen_height,
-                                         x: global.screen_width });
-
-        this._child1 = new St.Bin({ style_class: 'new-workspace-area',
-                                    width: width,
-                                    height: global.screen_height });
-        this._child2 =  new St.Bin({ style_class: 'new-workspace-area-internal',
-                                     width: width,
-                                     height: global.screen_height,
-                                     reactive: true });
-        this.actor.add_actor(this._child1);
-        this.actor.add_actor(this._child2);
-    },
-
-    setStyle: function(isHover) {
-        this._child1.set_hover(isHover);
-    }
-};
 
 function WorkspaceIndicator(activateWorkspace, workspaceAcceptDrop, workspaceHandleDragOver, scrollEventCb) {
     this._init(activateWorkspace, workspaceAcceptDrop, workspaceHandleDragOver, scrollEventCb);
@@ -636,12 +610,6 @@ SingleView.prototype = {
     __proto__: GenericWorkspacesView.prototype,
 
     _init: function(width, height, x, y, workspaces) {
-
-        this._newWorkspaceArea = new NewWorkspaceArea();
-        this._newWorkspaceArea.actor._delegate = {
-            acceptDrop: Lang.bind(this, this._acceptNewWorkspaceDrop)
-        };
-
         GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
 
         this._itemDragBeginId = Main.overview.connect('item-drag-begin',
@@ -655,8 +623,6 @@ SingleView.prototype = {
                                                                                Lang.bind(this, this._dragEnd));
         }
 
-        this.actor.add_actor(this._newWorkspaceArea.actor);
-
         this.actor.add_style_class_name('single');
         this.actor.set_clip(x, y, width, height);
         this._activeWorkspaceX = 0; // x offset of active ws while dragging
@@ -717,11 +683,6 @@ SingleView.prototype = {
 
             workspace.setSelected(false);
         }
-
-        this._newWorkspaceArea.scale = scale;
-        this._newWorkspaceArea.gridX = this._x + this._activeWorkspaceX
-                                       + (this._workspaces.length - active) * (_width + this._spacing);
-        this._newWorkspaceArea.gridY = this._y + this._activeWorkspaceY;
     },
 
     _transitionWorkspaces: function() {
@@ -905,19 +866,32 @@ SingleView.prototype = {
             workspace.gridX += dx;
 
             if (showAnimation) {
-                Tweener.addTween(workspace.actor,
-                    { x: workspace.gridX,
-                      y: workspace.gridY,
-                      scale_x: workspace.scale,
-                      scale_y: workspace.scale,
-                      opacity: workspace.opacity,
-                      time: WORKSPACE_SWITCH_TIME,
-                      transition: 'easeOutQuad'
-                    });
+                let params = { x: workspace.gridX,
+                               y: workspace.gridY,
+                               scale_x: workspace.scale,
+                               scale_y: workspace.scale,
+                               opacity: workspace.opacity,
+                               time: WORKSPACE_SWITCH_TIME,
+                               transition: 'easeOutQuad'
+                             };
+                // we have to call _updateVisibility() once before the
+                // animation and once afterwards - it does not really
+                // matter which tween we use, so we pick the first one ...
+                if (w == 0) {
+                    this._updateVisibility();
+                    params.onComplete = Lang.bind(this,
+                        function() {
+                            this._animating = false;
+                            this._updateVisibility();
+                        });
+                }
+                Tweener.addTween(workspace.actor, params);
             } else {
                 workspace.actor.set_scale(workspace.scale, workspace.scale);
                 workspace.actor.set_position(workspace.gridX, workspace.gridY);
                 workspace.actor.opacity = workspace.opacity;
+                if (w == 0)
+                    this._updateVisibility();
             }
         }
 
@@ -942,35 +916,6 @@ SingleView.prototype = {
                 this._cleanWorkspaces();
             }
         }
-
-        Tweener.removeTweens(this._newWorkspaceArea.actor);
-
-        this._newWorkspaceArea.gridX += dx;
-        if (showAnimation) {
-            // we have to call _updateVisibility() once before the
-            // animation and once afterwards - it does not really
-            // matter which tween we use, as long as it's not inside
-            // a loop ...
-            this._updateVisibility();
-            Tweener.addTween(this._newWorkspaceArea.actor,
-                             { x: this._newWorkspaceArea.gridX,
-                               y: this._newWorkspaceArea.gridY,
-                               scale_x: this._newWorkspaceArea.scale,
-                               scale_y: this._newWorkspaceArea.scale,
-                               time: WORKSPACE_SWITCH_TIME,
-                               transition: 'easeOutQuad',
-                               onComplete: Lang.bind(this, function() {
-                                   this._animating = false;
-                                   this._updateVisibility();
-                               })
-                             });
-        } else {
-            this._newWorkspaceArea.actor.set_scale(this._newWorkspaceArea.scale,
-                                                   this._newWorkspaceArea.scale);
-            this._newWorkspaceArea.actor.set_position(this._newWorkspaceArea.gridX,
-                                                      this._newWorkspaceArea.gridY);
-            this._updateVisibility();
-        }
     },
 
     _updateVisibility: function() {
@@ -1152,13 +1097,6 @@ SingleView.prototype = {
             } else {
                 rightWorkspace.opacity = rightWorkspace.actor.opacity = 200;
             }
-        } else {
-            let targetParent = dragEvent.targetActor.get_parent();
-            if (targetParent == this._newWorkspaceArea.actor) {
-                this._newWorkspaceArea.setStyle(true);
-                result = this._handleDragOverNewWorkspace(dragEvent.source, dragEvent.dragActor);
-            } else
-                this._newWorkspaceArea.setStyle(false);
         }
 
         // handle delayed workspace switches



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