From 03e8db6a00f1fe1e94d939014257d00bd53a88a6 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 4 Dec 2008 15:20:37 +0000 Subject: [PATCH] fix "desktop"/"workspace" naming confusion svn path=/trunk/; revision=116 --- js/ui/overlay.js | 34 ++++++++++++++-------------- js/ui/{desktops.js => workspaces.js} | 10 ++++---- 2 files changed, 22 insertions(+), 22 deletions(-) rename js/ui/{desktops.js => workspaces.js} (98%) diff --git a/js/ui/overlay.js b/js/ui/overlay.js index ee8ad46dd..fc0b36ba3 100644 --- a/js/ui/overlay.js +++ b/js/ui/overlay.js @@ -7,7 +7,7 @@ const Clutter = imports.gi.Clutter; const Gio = imports.gi.Gio; const Gtk = imports.gi.Gtk; -const Desktops = imports.ui.desktops; +const Workspaces = imports.ui.workspaces; const Main = imports.ui.main; const Panel = imports.ui.panel; const Meta = imports.gi.Meta; @@ -28,8 +28,8 @@ SIDESHOW_TEXT_COLOR.from_pixel(0xffffffff); // Time for initial animation going into overlay mode const ANIMATION_TIME = 0.5; -// How much to scale the desktop down by in overlay mode -const DESKTOP_SCALE = 0.75; +// How much of the screen the workspace grid takes up +const WORKSPACE_GRID_SCALE = 0.75; function Sideshow(parent, width) { this._init(parent, width); @@ -155,11 +155,12 @@ Overlay.prototype = { // TODO - recalculate everything when desktop size changes this._recalculateSize(); - this._desktops = new Desktops.Desktops(this._desktopX, this._desktopY, - this._desktopWidth, this._desktopHeight); - this._group.add_actor(this._desktops._group); + this._workspaces = new Workspaces.Workspaces( + this._workspaceGridX, this._workspaceGridY, + this._workspaceGridWidth, this._workspaceGridHeight); + this._group.add_actor(this._workspaces._group); - this._sideshow = new Sideshow(this._group, this._desktopX - 10); + this._sideshow = new Sideshow(this._group, this._workspaceGridX - 10); this._sideshow.connect('activated', function(sideshow) { // TODO - have some sort of animation/effect while // transitioning to the new app. We definitely need @@ -173,12 +174,11 @@ Overlay.prototype = { let screenWidth = global.screen_width; let screenHeight = global.screen_height; - // The desktop windows are shown on top of a scaled down version of the - // desktop. This is positioned at the right side of the screen - this._desktopWidth = screenWidth * DESKTOP_SCALE; - this._desktopHeight = screenHeight * DESKTOP_SCALE; - this._desktopX = screenWidth - this._desktopWidth - 10; - this._desktopY = Panel.PANEL_HEIGHT + (screenHeight - this._desktopHeight - Panel.PANEL_HEIGHT) / 2; + // 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() { @@ -192,8 +192,8 @@ Overlay.prototype = { this._recalculateSize(); this._sideshow.show(); - this._desktops.show(); - this._desktops._group.raise_top(); + this._workspaces.show(); + this._workspaces._group.raise_top(); // All the the actors in the window group are completely obscured, // hiding the group holding them while the overlay is displayed greatly @@ -210,7 +210,7 @@ Overlay.prototype = { if (!this.visible) return; - this._desktops.hide(); + this._workspaces.hide(); this._sideshow.hide(); // Dummy tween, just waiting for the workspace animation @@ -228,7 +228,7 @@ Overlay.prototype = { global.window_group.show(); this._group.lower_bottom(); this._group.hide(); - this._desktops.hideDone(); + this._workspaces.hideDone(); }, _deactivate : function() { diff --git a/js/ui/desktops.js b/js/ui/workspaces.js similarity index 98% rename from js/ui/desktops.js rename to js/ui/workspaces.js index 3357b5ffc..d2dfc4074 100644 --- a/js/ui/desktops.js +++ b/js/ui/workspaces.js @@ -17,7 +17,7 @@ const WINDOW_OPACITY = 0.9 * 255; // unless we have a really good algorithm. // Each triplet is [xCenter, yCenter, scale] where the scale -// is relative to the width of the desktop. +// is relative to the width of the workspace. const POSITIONS = { 1: [[0.5, 0.5, 0.8]], 2: [[0.25, 0.5, 0.4], [0.75, 0.5, 0.4]], @@ -26,14 +26,14 @@ const POSITIONS = { 5: [[0.165, 0.25, 0.28], [0.495, 0.25, 0.28], [0.825, 0.25, 0.28], [0.25, 0.75, 0.4], [0.75, 0.75, 0.4]] }; -// spacing between desktops +// spacing between workspaces const GRID_SPACING = 15; -function Desktops(x, y, width, height) { +function Workspaces(x, y, width, height) { this._init(x, y, width, height); } -Desktops.prototype = { +Workspaces.prototype = { _init : function(x, y, width, height) { this._group = new Clutter.Group(); @@ -223,7 +223,7 @@ Desktops.prototype = { return POSITIONS[numberOfWindows][windowIndex]; // If we don't have a predefined scheme for this window count, - // overlap the windows along the diagonal of the desktop + // overlap the windows along the diagonal of the workspace // (improve this!) let fraction = Math.sqrt(1/numberOfWindows);