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:
parent
2506673514
commit
e3957f3bac
@ -956,15 +956,15 @@ const Workspace = new Lang.Class({
|
|||||||
this._positionWindowsId = 0;
|
this._positionWindowsId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
setGeometry: function(x, y, width, height) {
|
setGeometry: function(geom) {
|
||||||
this._x = x;
|
this._x = geom.x;
|
||||||
this._y = y;
|
this._y = geom.y;
|
||||||
this._width = width;
|
this._width = geom.width;
|
||||||
this._height = height;
|
this._height = geom.height;
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||||
this._dropRect.set_position(x, y);
|
this._dropRect.set_position(geom.x, geom.y);
|
||||||
this._dropRect.set_size(width, height);
|
this._dropRect.set_size(geom.width, geom.height);
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -124,10 +124,7 @@ const WorkspacesView = new Lang.Class({
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
let ws = new Workspace.Workspace(null, i);
|
let ws = new Workspace.Workspace(null, i);
|
||||||
ws.setGeometry(monitors[i].x,
|
ws.setGeometry(monitors[i]);
|
||||||
monitors[i].y,
|
|
||||||
monitors[i].width,
|
|
||||||
monitors[i].height);
|
|
||||||
global.overlay_group.add_actor(ws.actor);
|
global.overlay_group.add_actor(ws.actor);
|
||||||
this._extraWorkspaces.push(ws);
|
this._extraWorkspaces.push(ws);
|
||||||
}
|
}
|
||||||
@ -139,18 +136,18 @@ const WorkspacesView = new Lang.Class({
|
|||||||
this._extraWorkspaces = [];
|
this._extraWorkspaces = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
setGeometry: function(x, y, width, height) {
|
setGeometry: function(geom) {
|
||||||
if (this._x == x && this._y == y &&
|
if (this._x == geom.x && this._y == geom.y &&
|
||||||
this._width == width && this._height == height)
|
this._width == geom.width && this._height == geom.height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._width = width;
|
this._width = geom.width;
|
||||||
this._height = height;
|
this._height = geom.height;
|
||||||
this._x = x;
|
this._x = geom.x;
|
||||||
this._y = y;
|
this._y = geom.y;
|
||||||
|
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
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) {
|
_lookupWorkspaceForMetaWindow: function (metaWindow) {
|
||||||
@ -281,8 +278,10 @@ const WorkspacesView = new Lang.Class({
|
|||||||
|
|
||||||
if (newNumWorkspaces > oldNumWorkspaces) {
|
if (newNumWorkspaces > oldNumWorkspaces) {
|
||||||
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
||||||
this._workspaces[w].setGeometry(this._x, this._y,
|
this._workspaces[w].setGeometry({ x: this._x,
|
||||||
this._width, this._height);
|
y: this._y,
|
||||||
|
width: this._width,
|
||||||
|
height: this._height });
|
||||||
this.actor.add_actor(this._workspaces[w].actor);
|
this.actor.add_actor(this._workspaces[w].actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,13 +644,10 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
let m = 0;
|
let m = 0;
|
||||||
for (let i = 0; i < monitors.length; i++) {
|
for (let i = 0; i < monitors.length; i++) {
|
||||||
if (i == this._primaryIndex) {
|
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++;
|
m++;
|
||||||
} else if (!this._workspacesOnlyOnPrimary) {
|
} else if (!this._workspacesOnlyOnPrimary) {
|
||||||
this._workspacesViews[m].setGeometry(monitors[i].x,
|
this._workspacesViews[m].setGeometry(monitors[i]);
|
||||||
monitors[i].y,
|
|
||||||
monitors[i].width,
|
|
||||||
monitors[i].height);
|
|
||||||
m++;
|
m++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user