suit.fair: restored C version fair layout's behaviour
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
67a9f0d302
commit
25ac879569
|
@ -22,14 +22,15 @@ local function fair(screen, orientation)
|
||||||
local cls = client.tiled(screen)
|
local cls = client.tiled(screen)
|
||||||
|
|
||||||
if #cls > 0 then
|
if #cls > 0 then
|
||||||
local cells = math.floor(math.sqrt(#cls))
|
local cells = math.ceil(math.sqrt(#cls))
|
||||||
local strips = math.ceil(#cls / cells)
|
local strips = math.ceil(#cls / cells)
|
||||||
|
|
||||||
local cell = 0
|
local cell = 0
|
||||||
local strip = 0
|
local strip = 0
|
||||||
for k, c in ipairs(cls) do
|
for k, c in ipairs(cls) do
|
||||||
local g = {}
|
local g = {}
|
||||||
if orientation == "east" then
|
if ( orientation == "east" and #cls > 2 )
|
||||||
|
or ( orientation == "south" and #cls <= 2 ) then
|
||||||
if #cls < (strips * cells) and strip == strips - 1 then
|
if #cls < (strips * cells) and strip == strips - 1 then
|
||||||
g.width = wa.width / (cells - ((strips * cells) - #cls))
|
g.width = wa.width / (cells - ((strips * cells) - #cls))
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue