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
|
||||
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 @@ Overlay.prototype = {
|
||||
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 @@ 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() {
|
||||
if (this.visible)
|
||||
return;
|
||||
@ -257,13 +249,9 @@ Overlay.prototype = {
|
||||
|
||||
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();
|
||||
|
||||
|
@ -38,25 +38,29 @@ const POSITIONS = {
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user