From ac3cc8a25d0422cccc3899eaf848903ab5b774cc Mon Sep 17 00:00:00 2001
From: Fabian Homborg <FHomborg@gmail.com>
Date: Wed, 23 Oct 2013 18:55:03 +0200
Subject: [PATCH] Use tile._currentDesktop instead of getting the client and
 using its desktop

---
 contents/code/tilingmanager.js | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/contents/code/tilingmanager.js b/contents/code/tilingmanager.js
index a300c95..de12282 100644
--- a/contents/code/tilingmanager.js
+++ b/contents/code/tilingmanager.js
@@ -292,8 +292,7 @@ TilingManager.prototype._onTileAdded = function(tile) {
 		self._onTileMovingStep(tile);
 	});
 	// Add the tile to the layouts
-	var client = tile.clients[0];
-	var tileLayouts = this._getLayouts(client.desktop, client.screen);
+	var tileLayouts = this._getLayouts(tile._currentDesktop, tile._currentScreen);
 	tileLayouts.forEach(function(layout) {
 		layout.addTile(tile);
 		tile.resizingEnded.connect(function() {
@@ -304,8 +303,7 @@ TilingManager.prototype._onTileAdded = function(tile) {
 };
 
 TilingManager.prototype._onTileRemoved = function(tile) {
-	var client = tile.clients[0];
-	var tileLayouts = this._getLayouts(client.desktop, client.screen);
+	var tileLayouts = this._getLayouts(tile._currentDesktop, tile._currentScreen);
 	tileLayouts.forEach(function(layout) {
 		layout.removeTile(tile);
 	});
-- 
GitLab