Move Workspaces-size computation into Workspaces
svn path=/trunk/; revision=134
This commit is contained in:
parent
a168f6da42
commit
45ba65bebb
@ -34,6 +34,9 @@ const ANIMATION_TIME = 0.5;
|
|||||||
// How much of the screen the workspace grid takes up
|
// How much of the screen the workspace grid takes up
|
||||||
const WORKSPACE_GRID_SCALE = 0.75;
|
const WORKSPACE_GRID_SCALE = 0.75;
|
||||||
|
|
||||||
|
// Padding around workspace grid / Spacing between Sideshow and Workspaces
|
||||||
|
const WORKSPACE_GRID_PADDING = 10;
|
||||||
|
|
||||||
function Sideshow(parent, width) {
|
function Sideshow(parent, width) {
|
||||||
this._init(parent, width);
|
this._init(parent, width);
|
||||||
}
|
}
|
||||||
@ -226,9 +229,10 @@ Overlay.prototype = {
|
|||||||
global.overlay_group.add_actor(this._group);
|
global.overlay_group.add_actor(this._group);
|
||||||
|
|
||||||
// TODO - recalculate everything when desktop size changes
|
// TODO - recalculate everything when desktop size changes
|
||||||
this._recalculateSize();
|
let screenWidth = global.screen_width;
|
||||||
|
let sideshowWidth = screenWidth - (screenWidth * WORKSPACE_GRID_SCALE) -
|
||||||
this._sideshow = new Sideshow(this._group, this._workspaceGridX - 10);
|
2 * WORKSPACE_GRID_PADDING;
|
||||||
|
this._sideshow = new Sideshow(this._group, sideshowWidth);
|
||||||
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
|
||||||
@ -237,18 +241,6 @@ Overlay.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_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() {
|
show : function() {
|
||||||
if (this.visible)
|
if (this.visible)
|
||||||
return;
|
return;
|
||||||
@ -257,13 +249,9 @@ Overlay.prototype = {
|
|||||||
|
|
||||||
let global = Shell.Global.get();
|
let global = Shell.Global.get();
|
||||||
|
|
||||||
this._recalculateSize();
|
|
||||||
|
|
||||||
this._sideshow.show();
|
this._sideshow.show();
|
||||||
|
|
||||||
this._workspaces = new Workspaces.Workspaces(
|
this._workspaces = new Workspaces.Workspaces();
|
||||||
this._workspaceGridX, this._workspaceGridY,
|
|
||||||
this._workspaceGridWidth, this._workspaceGridHeight);
|
|
||||||
this._group.add_actor(this._workspaces.actor);
|
this._group.add_actor(this._workspaces.actor);
|
||||||
this._workspaces.actor.raise_top();
|
this._workspaces.actor.raise_top();
|
||||||
|
|
||||||
|
@ -38,25 +38,29 @@ const POSITIONS = {
|
|||||||
// metaphor-breaking, but the alternatives are also weird.
|
// metaphor-breaking, but the alternatives are also weird.
|
||||||
const GRID_SPACING = 15;
|
const GRID_SPACING = 15;
|
||||||
|
|
||||||
function Workspaces(x, y, width, height) {
|
function Workspaces() {
|
||||||
this._init(x, y, width, height);
|
this._init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Workspaces.prototype = {
|
Workspaces.prototype = {
|
||||||
_init : function(x, y, width, height) {
|
_init : function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
let global = Shell.Global.get();
|
||||||
|
|
||||||
this.actor = new Clutter.Group();
|
this.actor = new Clutter.Group();
|
||||||
|
|
||||||
this._x = x;
|
let screenWidth = global.screen_width;
|
||||||
this._y = y;
|
let screenHeight = global.screen_height;
|
||||||
this._width = width;
|
|
||||||
this._height = 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._workspaces = [];
|
||||||
|
|
||||||
this._clones = [];
|
this._clones = [];
|
||||||
|
|
||||||
let global = Shell.Global.get();
|
|
||||||
let windows = global.get_windows();
|
let windows = global.get_windows();
|
||||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||||
let activeWorkspace;
|
let activeWorkspace;
|
||||||
|
Loading…
Reference in New Issue
Block a user