Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit f87c081

Browse files
committed
Tile: Simplify maximize code
1 parent 6159144 commit f87c081

File tree

1 file changed

+9
-40
lines changed

1 file changed

+9
-40
lines changed

contents/code/tile.js

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ Tile.prototype.setGeometry = function(geometry) {
129129
if (geometry == null) {
130130
return;
131131
}
132-
if (this.maximize == true) {
133-
this.oldRect = util.copyRect(geometry);
134-
return;
135-
}
136132
if (this.rectangle == null) {
137133
this.rectangle = util.copyRect(geometry);
138134
} else {
@@ -293,11 +289,7 @@ Tile.prototype.setClientGeometry = function(client) {
293289
}
294290

295291
client.tiling_resize = true;
296-
// Don't accidentally maximize windows
297-
var eBM = options.electricBorderMaximize;
298-
options.electricBorderMaximize = false;
299292
client.geometry = util.copyRect(this.rectangle);
300-
options.electricBorderMaximize = eBM;
301293

302294
if (changedRect == true) {
303295
this._resizing = true;
@@ -394,40 +386,17 @@ Tile.prototype.addClient = function(client) {
394386

395387
Tile.prototype.onClientMaximizedStateChanged = function(client, h, v) {
396388
try {
397-
// Reset this so setGeometry does its thing
398-
this.maximize = false;
399-
var screenRect = workspace.clientArea(KWin.PlacementArea, this._currentScreen, this._currentDesktop);
400-
if (this.rectangle != null) {
401-
var newRect = util.copyRect(this.rectangle);
402-
} else {
403-
var newRect = util.copyRect(screenRect);
404-
}
405-
// FIXME: If h was never true, maximizing and then unmaximizing v restores x/width to previous values
406-
// Instead, we should save h _and_ v
407-
if (h == true) {
408-
newRect.x = screenRect.x;
409-
newRect.width = screenRect.width;
410-
} else {
411-
if (this.oldRect != null) {
412-
newRect.x = this.oldRect.x;
413-
newRect.width = this.oldRect.width;
414-
}
415-
}
416-
if (v == true) {
417-
newRect.y = screenRect.y;
418-
newRect.height = screenRect.height;
419-
} else {
420-
if (this.oldRect != null) {
421-
newRect.y = this.oldRect.y;
422-
newRect.height = this.oldRect.height;
423-
}
424-
}
425-
this.oldRect = util.copyRect(this.rectangle);
426-
this.setGeometry(newRect);
427389
// Set keepBelow to keep maximized clients over tiled ones
428-
if (h == true || v == true) {
390+
// TODO: We don't distinguish between horizontal and vertical maximization,
391+
// also there's no way to find that the _user_ caused this.
392+
// So we might want to ignore maximization entirely.
393+
if (h || v) {
429394
client.keepBelow = false;
430-
this.maximize = true;
395+
// We might get a geometryChanged signal before this
396+
// so we need to manually maximize the client.
397+
client.tiling_resize = true;
398+
client.geometry = workspace.clientArea(KWin.MaximizeFullArea, this._currentScreen, this._currentDesktop);
399+
client.tiling_resize = false;
431400
} else {
432401
client.keepBelow = true;
433402
}

0 commit comments

Comments
 (0)