Merge pull request #315 from Elv13/fix_wfact

client: do not assume that wfact exists
This commit is contained in:
Emmanuel Lepage Vallée 2015-07-16 12:38:15 -04:00
commit 8917972c16
1 changed files with 13 additions and 1 deletions

View File

@ -831,7 +831,19 @@ function client.setwfact(wfact, c)
local data = tag.getproperty(t, "windowfact") or {}
local colfact = data[w.col]
local need_normalize = colfact ~= nil
if not need_normalize then
colfact = {}
end
colfact[w.idx] = wfact
if not need_normalize then
t:emit_signal("property::windowfact")
return
end
local rest = 1-wfact
-- calculate the current denominator
@ -866,7 +878,7 @@ function client.incwfact(add, c)
local nmaster = tag.getnmaster(t)
local data = tag.getproperty(t, "windowfact") or {}
local colfact = data[w.col]
local colfact = data[w.col] or {}
curr = colfact[w.idx] or 1
colfact[w.idx] = curr + add