diff --git a/contents/code/tile.js b/contents/code/tile.js index 285bbcc30417ba9a3aa8f78aa1114b4dbeaf7e8f..ac96c8f885f05668ca9888adaa38873cb9030bc3 100644 --- a/contents/code/tile.js +++ b/contents/code/tile.js @@ -105,6 +105,8 @@ function Tile(firstClient, tileIndex) { */ this._currentDesktop = firstClient.desktop; + this.rectangle = null; + this.syncCustomProperties(); } @@ -115,8 +117,17 @@ function Tile(firstClient, tileIndex) { * @param geometry New tile geometry. */ Tile.prototype.setGeometry = function(geometry) { - this.clients[0].geometry = geometry; - // TODO: Inhibit geometryChanged events? + if (geometry == null) { + return; + } + this.rectangle = geometry; + for(i = 0; i < this.clients.length; i++) { + this.clients[i].geometry = geometry; + } +}; + +Tile.prototype.resetGeometry = function() { + this.setGeometry(this.rectangle); }; /** @@ -210,6 +221,12 @@ Tile.prototype.onClientGeometryChanged = function(client) { if (this._moving || this.resizing) { return; } + if (this.rectangle != null) { + client.geometry.x = this.rectangle.x; + client.geometry.y = this.rectangle.y; + client.geometry.width = this.rectangle.width; + client.geometry.height = this.rectangle.height; + } // TODO: Check whether we caused the geometry change this.geometryChanged.emit(); }; diff --git a/contents/code/tilelist.js b/contents/code/tilelist.js index ccc9a7dd9971cd0636cabf67aeb07a4969ed275a..c27a730f539a989a0becf8c74f06f351dca975ab 100644 --- a/contents/code/tilelist.js +++ b/contents/code/tilelist.js @@ -74,7 +74,7 @@ TileList.prototype.addClient = function(client) { client.shadeChanged.connect(function() { getTile(client).onClientShadeChanged(client); }); - client.geometryChanged.connect(function() { + client.geometryShapeChanged.connect(function() { getTile(client).onClientGeometryChanged(client); }); client.keepAboveChanged.connect(function() { diff --git a/contents/code/tiling.js b/contents/code/tiling.js index b3e3df021d590464473e624047a02810353b8b9c..b3faa1b932f2082e3b9feb16164f3a78fa582938 100644 --- a/contents/code/tiling.js +++ b/contents/code/tiling.js @@ -72,10 +72,8 @@ Tiling.prototype.addTile = function(tile, x, y) { } else { this.tiles.push(tile); } - if (this.active) { - this._updateAllTiles(); - // TODO: Register tile callbacks - } + this._updateAllTiles(); + // TODO: Register tile callbacks } Tiling.prototype.removeTile = function(tile) { @@ -196,20 +194,11 @@ Tiling.prototype._updateAllTiles = function() { // Set the position/size of all tiles if (this.active) { for (var i = 0; i < this.layout.tiles.length; i++) { - var currentRect = this.tiles[i].clients[0].geometry; var newRect = this.layout.tiles[i].rectangle; if (! newRect) { return; } - // Is this necessary? - if (currentRect.x != newRect.x - || currentRect.y != newRect.y - || currentRect.width != newRect.width - || currentRect.height != newRect.height) { - if (! this.tiles[i].clients[0].fullScreen) { - this.tiles[i].setGeometry(newRect); - } - } + this.tiles[i].setGeometry(newRect); } } } diff --git a/contents/code/tilingmanager.js b/contents/code/tilingmanager.js index cae7b2b63ff10420a373b67fb0cb2620c55b1e77..dbdad1b0ab6cef37392a6dc0e7b165e2bc72dfa7 100644 --- a/contents/code/tilingmanager.js +++ b/contents/code/tilingmanager.js @@ -122,13 +122,6 @@ function TilingManager() { //client.tiling_floating = null; }); - // TODO: Properly tile on startup - // Create the initial list of tiles - existingClients.forEach(function(client) { - print("Adding existing client", client.resourceClass.toString()); - self.tiles.addClient(client); - }); - // Register global callbacks workspace.numberDesktopsChanged.connect(function() { self._onNumberDesktopsChanged(); @@ -309,6 +302,7 @@ TilingManager.prototype._onTileAdded = function(tile) { layout.resizeTile(tile); }); }); + tile.resetGeometry(); }; TilingManager.prototype._onTileRemoved = function(tile) {