From: Josh Timmer <0ohexxo0@gmail.com> Date: Wed, 9 Sep 2015 01:01:40 +0000 (-0400) Subject: Fixed some 1 pixel discrepancies in uselesstile X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/c477cc64fd484f9cc1e1c78e9b22e1f099e75838?ds=sidebyside;hp=b658401b3307992aef9ff284c8b836a329cfd8b5 Fixed some 1 pixel discrepancies in uselesstile --- diff --git a/layout/uselesstile.lua b/layout/uselesstile.lua index e48c85d..b94a74d 100644 --- a/layout/uselesstile.lua +++ b/layout/uselesstile.lua @@ -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 }