From bc1a2f544806734d4ffb7253abcdd63e39a6b321 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Fri, 6 Feb 2009 15:08:47 +0100 Subject: [PATCH] awful.hooks.timer: fix timer removal Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- lib/awful/hooks.lua.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/awful/hooks.lua.in b/lib/awful/hooks.lua.in index d35103207..613fae94b 100644 --- a/lib/awful/hooks.lua.in +++ b/lib/awful/hooks.lua.in @@ -54,7 +54,7 @@ for name, hook in pairs(capi.hooks) do _M[name] = {} if name == 'timer' then _M[name].register = function (time, f, runnow) - if type(time) ~= 'number' or type(f) ~= 'function' or time <= 0 then + if type(time) ~= 'number' or type(f) ~= 'function' or time < 0 then return end local new_timer @@ -94,6 +94,12 @@ for name, hook in pairs(capi.hooks) do break end end + local delays = { } + for k, h in ipairs(_M[name].callbacks) do + table.insert(delays, h.timer) + end + table.sort(delays) + hook(delays[1]) end end elseif name == "dbus" then