workspacesView: Make setGeometry take a rectangle

This cleanup will be more important in the future,
but for now, we can simply pass a monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=694469
This commit is contained in:
Jasper St. Pierre 2013-02-25 17:05:51 -05:00
parent 2506673514
commit e3957f3bac
2 changed files with 22 additions and 26 deletions

View File

@ -956,15 +956,15 @@ const Workspace = new Lang.Class({
this._positionWindowsId = 0;
},
setGeometry: function(x, y, width, height) {
this._x = x;
this._y = y;
this._width = width;
this._height = height;
setGeometry: function(geom) {
this._x = geom.x;
this._y = geom.y;
this._width = geom.width;
this._height = geom.height;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
this._dropRect.set_position(x, y);
this._dropRect.set_size(width, height);
this._dropRect.set_position(geom.x, geom.y);
this._dropRect.set_size(geom.width, geom.height);
return false;
}));

View File

@ -124,10 +124,7 @@ const WorkspacesView = new Lang.Class({
continue;
let ws = new Workspace.Workspace(null, i);
ws.setGeometry(monitors[i].x,
monitors[i].y,
monitors[i].width,
monitors[i].height);
ws.setGeometry(monitors[i]);
global.overlay_group.add_actor(ws.actor);
this._extraWorkspaces.push(ws);
}
@ -139,18 +136,18 @@ const WorkspacesView = new Lang.Class({
this._extraWorkspaces = [];
},
setGeometry: function(x, y, width, height) {
if (this._x == x && this._y == y &&
this._width == width && this._height == height)
setGeometry: function(geom) {
if (this._x == geom.x && this._y == geom.y &&
this._width == geom.width && this._height == geom.height)
return;
this._width = width;
this._height = height;
this._x = x;
this._y = y;
this._width = geom.width;
this._height = geom.height;
this._x = geom.x;
this._y = geom.y;
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setGeometry(x, y, width, height);
this._workspaces[i].setGeometry(geom);
},
_lookupWorkspaceForMetaWindow: function (metaWindow) {
@ -281,8 +278,10 @@ const WorkspacesView = new Lang.Class({
if (newNumWorkspaces > oldNumWorkspaces) {
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
this._workspaces[w].setGeometry(this._x, this._y,
this._width, this._height);
this._workspaces[w].setGeometry({ x: this._x,
y: this._y,
width: this._width,
height: this._height });
this.actor.add_actor(this._workspaces[w].actor);
}
@ -645,13 +644,10 @@ const WorkspacesDisplay = new Lang.Class({
let m = 0;
for (let i = 0; i < monitors.length; i++) {
if (i == this._primaryIndex) {
this._workspacesViews[m].setGeometry(x, y, width, height);
this._workspacesViews[m].setGeometry({ x: x, y: y, width: width, height: height });
m++;
} else if (!this._workspacesOnlyOnPrimary) {
this._workspacesViews[m].setGeometry(monitors[i].x,
monitors[i].y,
monitors[i].width,
monitors[i].height);
this._workspacesViews[m].setGeometry(monitors[i]);
m++;
}
}