layout: spiral: remove the variable i

We have i == k - 1 and k is unused.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Fabienne Ducroquet 2009-08-19 20:37:21 +02:00 committed by Julien Danjou
parent 98953ed6f1
commit 46f5476e20
1 changed files with 11 additions and 13 deletions

View File

@ -14,7 +14,6 @@ local function spiral(p, dwindle)
local wa = p.workarea local wa = p.workarea
local cls = p.clients local cls = p.clients
local i = 0
local n = #cls local n = #cls
local nx = wa.x local nx = wa.x
local ny = wa.y local ny = wa.y
@ -22,41 +21,40 @@ local function spiral(p, dwindle)
local nh = wa.height local nh = wa.height
for k, c in ipairs(cls) do for k, c in ipairs(cls) do
if (i % 2 == 1 and nh / 2 > 2 * c.border_width) if (k % 2 == 0 and nh / 2 > 2 * c.border_width)
or (i % 2 == 0 and nw / 2 > 2 * c.border_width) then or (k % 2 == 1 and nw / 2 > 2 * c.border_width) then
if i < n - 1 then if k < n then
if i % 2 == 1 then if k % 2 == 0 then
nh = nh / 2 nh = nh / 2
else else
nw = nw / 2 nw = nw / 2
end end
if i % 4 == 2 and not dwindle then if k % 4 == 3 and not dwindle then
nx = nx + nw nx = nx + nw
elseif i % 4 == 3 and not dwindle then elseif k % 4 == 0 and not dwindle then
ny = ny + nh ny = ny + nh
end end
end end
if i % 4 == 0 then if k % 4 == 1 then
if dwindle then if dwindle then
ny = ny + nh ny = ny + nh
else else
ny = ny - nh ny = ny - nh
end end
elseif i % 4 == 1 then elseif k % 4 == 2 then
nx = nx + nw nx = nx + nw
elseif i % 4 == 2 then elseif k % 4 == 3 then
ny = ny + nh ny = ny + nh
elseif i % 4 == 3 then elseif k % 4 == 0 then
if dwindle then if dwindle then
nx = nx + nw nx = nx + nw
else else
nx = nx - nw nx = nx - nw
end end
end end
if i == 0 then if k == 1 then
ny = wa.y ny = wa.y
end end
i = i + 1
end end
local geom = { x = nx, y = ny, width = nw, height = nh } local geom = { x = nx, y = ny, width = nw, height = nh }
c:geometry(geom) c:geometry(geom)