]> git.madduck.net Git - etc/awesome.git/blobdiff - layout/uselesstile.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fixed some 1 pixel discrepancies in uselesstile
[etc/awesome.git] / layout / uselesstile.lua
index e48c85d4b9132f096de26a0a0b6985c5f1584505..b94a74d45c3eb1c4bf38e05a133838131e7e165e 100644 (file)
@@ -37,7 +37,7 @@ end
 
 -- Find geometry for secondary windows column
 local function cut_column(wa, n, index)
-    local width = wa.width / n
+    local width = math.floor(wa.width / n)
     local area = { x = wa.x + (index - 1) * width, y = wa.y, width = width, height = wa.height }
 
     return area
@@ -45,7 +45,7 @@ end
 
 -- Find geometry for certain window in column
 local function cut_row(wa, factor, index, used)
-    local height = wa.height * factor.window[index] / factor.total
+    local height = math.floor(wa.height * factor.window[index] / factor.total)
     local area = { x = wa.x, y = wa.y + used, width = wa.width, height = height }
 
     return area
@@ -55,8 +55,8 @@ end
 local function size_correction(c, geometry, useless_gap)
     geometry.width  = math.max(geometry.width  - 2 * c.border_width - useless_gap, 1)
     geometry.height = math.max(geometry.height - 2 * c.border_width - useless_gap, 1)
-    geometry.x = geometry.x + useless_gap / 2
-    geometry.y = geometry.y + useless_gap / 2
+    geometry.x = math.floor(geometry.x + useless_gap / 2)
+    geometry.y = math.floor(geometry.y + useless_gap / 2)
 end
 
 -- Check size factor for group of clients and calculate total
@@ -85,6 +85,7 @@ local function tile_column(canvas, area, list, useless_gap, transformation, winf
 
     for i, c in ipairs(list) do
         local g = cut_row(area, factor, i, used)
+        if i == #list then g.height = area.height - used end
         used = used + g.height
 
         -- swap workarea dimensions
@@ -94,6 +95,7 @@ local function tile_column(canvas, area, list, useless_gap, transformation, winf
         -- useless gap and border correction
         size_correction(c, g, useless_gap)
 
+
         c:geometry(g)
     end
 end
@@ -161,7 +163,7 @@ local function tile(p, orientation)
     local master_area = {
         x = wa.x,
         y = wa.y,
-        width  = nmaster > 0 and wa.width * mwfact or 0,
+        width  = nmaster > 0 and math.floor(wa.width * mwfact) or 0,
         height = wa.height
     }