gnome-shell r134 - trunk/js/ui



Author: danw
Date: Mon Dec 22 21:50:23 2008
New Revision: 134
URL: http://svn.gnome.org/viewvc/gnome-shell?rev=134&view=rev

Log:
Move Workspaces-size computation into Workspaces


Modified:
   trunk/js/ui/overlay.js
   trunk/js/ui/workspaces.js

Modified: trunk/js/ui/overlay.js
==============================================================================
--- trunk/js/ui/overlay.js	(original)
+++ trunk/js/ui/overlay.js	Mon Dec 22 21:50:23 2008
@@ -34,6 +34,9 @@
 // How much of the screen the workspace grid takes up
 const WORKSPACE_GRID_SCALE = 0.75;
 
+// Padding around workspace grid / Spacing between Sideshow and Workspaces
+const WORKSPACE_GRID_PADDING = 10;
+
 function Sideshow(parent, width) {
     this._init(parent, width);
 }
@@ -226,9 +229,10 @@
         global.overlay_group.add_actor(this._group);
 
         // TODO - recalculate everything when desktop size changes
-        this._recalculateSize();
-
-        this._sideshow = new Sideshow(this._group, this._workspaceGridX - 10);
+        let screenWidth = global.screen_width;
+        let sideshowWidth = screenWidth - (screenWidth * WORKSPACE_GRID_SCALE) -
+            2 * WORKSPACE_GRID_PADDING;
+        this._sideshow = new Sideshow(this._group, sideshowWidth);
         this._sideshow.connect('activated', function(sideshow) {
             // TODO - have some sort of animation/effect while
             // transitioning to the new app.  We definitely need
@@ -237,18 +241,6 @@
         });
     },
 
-    _recalculateSize: function() {
-        let global = Shell.Global.get();
-        let screenWidth = global.screen_width;
-        let screenHeight = global.screen_height;
-
-        // The area allocated for the workspace grid
-        this._workspaceGridWidth = screenWidth * WORKSPACE_GRID_SCALE;
-        this._workspaceGridHeight = screenHeight * WORKSPACE_GRID_SCALE;
-        this._workspaceGridX = screenWidth - this._workspaceGridWidth - 10;
-        this._workspaceGridY = Panel.PANEL_HEIGHT + (screenHeight - this._workspaceGridHeight - Panel.PANEL_HEIGHT) / 2;
-    },
-
     show : function() {
         if (this.visible)
             return;
@@ -257,13 +249,9 @@
 
         let global = Shell.Global.get();
 
-        this._recalculateSize();
-
         this._sideshow.show();
 
-        this._workspaces = new Workspaces.Workspaces(
-            this._workspaceGridX, this._workspaceGridY,
-            this._workspaceGridWidth, this._workspaceGridHeight);
+        this._workspaces = new Workspaces.Workspaces();
         this._group.add_actor(this._workspaces.actor);
         this._workspaces.actor.raise_top();
 

Modified: trunk/js/ui/workspaces.js
==============================================================================
--- trunk/js/ui/workspaces.js	(original)
+++ trunk/js/ui/workspaces.js	Mon Dec 22 21:50:23 2008
@@ -38,25 +38,29 @@
 // metaphor-breaking, but the alternatives are also weird.
 const GRID_SPACING = 15;
 
-function Workspaces(x, y, width, height) {
-    this._init(x, y, width, height);
+function Workspaces() {
+    this._init();
 }
 
 Workspaces.prototype = {
-    _init : function(x, y, width, height) {
+    _init : function() {
         let me = this;
+        let global = Shell.Global.get();
 
         this.actor = new Clutter.Group();
 
-        this._x = x;
-        this._y = y;
-        this._width = width;
-        this._height = height;
+        let screenWidth = global.screen_width;
+        let screenHeight = global.screen_height;
+
+        this._width = screenWidth * Overlay.WORKSPACE_GRID_SCALE;
+        this._height = screenHeight * Overlay.WORKSPACE_GRID_SCALE;
+        this._x = screenWidth - this._width - Overlay.WORKSPACE_GRID_PADDING;
+        this._y = Panel.PANEL_HEIGHT + (screenHeight - this._height - Panel.PANEL_HEIGHT) / 2;
+
         this._workspaces = [];
         
         this._clones = [];
 
-        let global = Shell.Global.get();
         let windows = global.get_windows();
         let activeWorkspaceIndex = global.screen.get_active_workspace_index();
         let activeWorkspace;



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