fix "desktop"/"workspace" naming confusion

svn path=/trunk/; revision=116
This commit is contained in:
Dan Winship 2008-12-04 15:20:37 +00:00
parent 79d956b719
commit 03e8db6a00
2 changed files with 22 additions and 22 deletions

View File

@ -7,7 +7,7 @@ const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk; const Gtk = imports.gi.Gtk;
const Desktops = imports.ui.desktops; const Workspaces = imports.ui.workspaces;
const Main = imports.ui.main; const Main = imports.ui.main;
const Panel = imports.ui.panel; const Panel = imports.ui.panel;
const Meta = imports.gi.Meta; const Meta = imports.gi.Meta;
@ -28,8 +28,8 @@ SIDESHOW_TEXT_COLOR.from_pixel(0xffffffff);
// Time for initial animation going into overlay mode // Time for initial animation going into overlay mode
const ANIMATION_TIME = 0.5; const ANIMATION_TIME = 0.5;
// How much to scale the desktop down by in overlay mode // How much of the screen the workspace grid takes up
const DESKTOP_SCALE = 0.75; const WORKSPACE_GRID_SCALE = 0.75;
function Sideshow(parent, width) { function Sideshow(parent, width) {
this._init(parent, width); this._init(parent, width);
@ -155,11 +155,12 @@ Overlay.prototype = {
// TODO - recalculate everything when desktop size changes // TODO - recalculate everything when desktop size changes
this._recalculateSize(); this._recalculateSize();
this._desktops = new Desktops.Desktops(this._desktopX, this._desktopY, this._workspaces = new Workspaces.Workspaces(
this._desktopWidth, this._desktopHeight); this._workspaceGridX, this._workspaceGridY,
this._group.add_actor(this._desktops._group); 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) { this._sideshow.connect('activated', function(sideshow) {
// TODO - have some sort of animation/effect while // TODO - have some sort of animation/effect while
// transitioning to the new app. We definitely need // transitioning to the new app. We definitely need
@ -173,12 +174,11 @@ Overlay.prototype = {
let screenWidth = global.screen_width; let screenWidth = global.screen_width;
let screenHeight = global.screen_height; let screenHeight = global.screen_height;
// The desktop windows are shown on top of a scaled down version of the // The area allocated for the workspace grid
// desktop. This is positioned at the right side of the screen this._workspaceGridWidth = screenWidth * WORKSPACE_GRID_SCALE;
this._desktopWidth = screenWidth * DESKTOP_SCALE; this._workspaceGridHeight = screenHeight * WORKSPACE_GRID_SCALE;
this._desktopHeight = screenHeight * DESKTOP_SCALE; this._workspaceGridX = screenWidth - this._workspaceGridWidth - 10;
this._desktopX = screenWidth - this._desktopWidth - 10; this._workspaceGridY = Panel.PANEL_HEIGHT + (screenHeight - this._workspaceGridHeight - Panel.PANEL_HEIGHT) / 2;
this._desktopY = Panel.PANEL_HEIGHT + (screenHeight - this._desktopHeight - Panel.PANEL_HEIGHT) / 2;
}, },
show : function() { show : function() {
@ -192,8 +192,8 @@ Overlay.prototype = {
this._recalculateSize(); this._recalculateSize();
this._sideshow.show(); this._sideshow.show();
this._desktops.show(); this._workspaces.show();
this._desktops._group.raise_top(); this._workspaces._group.raise_top();
// All the the actors in the window group are completely obscured, // All the the actors in the window group are completely obscured,
// hiding the group holding them while the overlay is displayed greatly // hiding the group holding them while the overlay is displayed greatly
@ -210,7 +210,7 @@ Overlay.prototype = {
if (!this.visible) if (!this.visible)
return; return;
this._desktops.hide(); this._workspaces.hide();
this._sideshow.hide(); this._sideshow.hide();
// Dummy tween, just waiting for the workspace animation // Dummy tween, just waiting for the workspace animation
@ -228,7 +228,7 @@ Overlay.prototype = {
global.window_group.show(); global.window_group.show();
this._group.lower_bottom(); this._group.lower_bottom();
this._group.hide(); this._group.hide();
this._desktops.hideDone(); this._workspaces.hideDone();
}, },
_deactivate : function() { _deactivate : function() {

View File

@ -17,7 +17,7 @@ const WINDOW_OPACITY = 0.9 * 255;
// unless we have a really good algorithm. // unless we have a really good algorithm.
// Each triplet is [xCenter, yCenter, scale] where the scale // 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 = { const POSITIONS = {
1: [[0.5, 0.5, 0.8]], 1: [[0.5, 0.5, 0.8]],
2: [[0.25, 0.5, 0.4], [0.75, 0.5, 0.4]], 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]] 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; const GRID_SPACING = 15;
function Desktops(x, y, width, height) { function Workspaces(x, y, width, height) {
this._init(x, y, width, height); this._init(x, y, width, height);
} }
Desktops.prototype = { Workspaces.prototype = {
_init : function(x, y, width, height) { _init : function(x, y, width, height) {
this._group = new Clutter.Group(); this._group = new Clutter.Group();
@ -223,7 +223,7 @@ Desktops.prototype = {
return POSITIONS[numberOfWindows][windowIndex]; return POSITIONS[numberOfWindows][windowIndex];
// If we don't have a predefined scheme for this window count, // 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!) // (improve this!)
let fraction = Math.sqrt(1/numberOfWindows); let fraction = Math.sqrt(1/numberOfWindows);