awful.hooks: finally and for the last time fix timer removal

Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2009-02-06 20:55:38 +01:00 committed by Julien Danjou
parent 90241e4076
commit ef6d6dd12c
1 changed files with 10 additions and 1 deletions

View File

@ -99,7 +99,16 @@ for name, hook in pairs(capi.hooks) do
table.insert(delays, h.timer)
end
table.sort(delays)
hook(delays[1])
_M[name].timer = delays[1]
hook(delays[1], function (...)
for i, callback in ipairs(_M[name].callbacks) do
callback['counter'] = callback['counter'] + _M[name].timer
if callback['counter'] >= callback['timer'] then
callback['callback'](...)
callback['counter'] = 0
end
end
end)
end
end
elseif name == "dbus" then