summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2009-02-21 18:56:36 +0900
committerSam Spilsbury <smspillaz@gmail.com>2009-02-21 18:56:36 +0900
commit7c5074ed2740560622faee623b76af3dc6972f50 (patch)
tree9df6c36bd8a48897a608e9910959ce717608a457
parentd3ae75668c49552181c2be72b8d838e0650eb20b (diff)
downloadtile-7c5074ed2740560622faee623b76af3dc6972f50.tar.gz
tile-7c5074ed2740560622faee623b76af3dc6972f50.tar.bz2
Fix square tile mode
-rw-r--r--tile.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tile.cpp b/tile.cpp
index 4e08092..817e84a 100644
--- a/tile.cpp
+++ b/tile.cpp
@@ -672,7 +672,8 @@ TileScreen::squareTile (CompWindowExtents &border,
int currentY = workArea.y;
int winWidth = workArea.width / countX;
int winHeight = workArea.height / countY;
- int i = 0;
+ int i_x = 0;
+ int i_y = 0;
foreach (CompWindow *w, screen->windows ())
{
@@ -685,20 +686,23 @@ TileScreen::squareTile (CompWindowExtents &border,
winWidth,
winHeight);
- /* If we have reached countX ... */
- if (!(i % countX))
+ /* If we have reached countX - 1 ... */
+ if (i_x == countX - 1)
{
/* Reset currentX back to the workArea start
* and move current Y
*/
currentX = workArea.x;
currentY += winHeight;
+ i_x = 0;
+ i_y++;
}
/* Otherwise, add winWidth to currentX */
else
+ {
+ i_x++;
currentX += winWidth;
-
- i++;
+ }
}
}