Updated timers for the upcoming awesome 3.4

This commit is contained in:
Adrian C. (anrxc) 2009-08-26 03:27:18 +02:00
parent 53b2799cad
commit 853fafcdd3
1 changed files with 11 additions and 7 deletions

View File

@ -27,11 +27,7 @@ local table = {
} }
-- Grab C API -- Grab C API
local capi = { local capi = { timer = timer }
hooks = hooks,
widget = widget,
awesome = awesome,
}
-- }}} -- }}}
@ -67,6 +63,7 @@ module("vicious")
-- {{{ Initialise variables -- {{{ Initialise variables
local timers = {}
local registered = {} local registered = {}
local widget_cache = {} local widget_cache = {}
@ -153,7 +150,11 @@ function regregister(reg)
-- Start timer -- Start timer
if reg.timer > 0 then if reg.timer > 0 then
awful.hooks.timer.register(reg.timer, reg.update) timers[reg.update] = {
timer = capi.timer({ timeout = reg.timer })
}
timers[reg.update].timer:add_signal("timeout", reg.update)
timers[reg.update].timer:start()
end end
-- Initial update -- Initial update
@ -191,7 +192,10 @@ function unregister(widget, keep, reg)
end end
end end
awful.hooks.timer.unregister(reg.update) -- Stop timer
if timers[reg.update].timer.started then
timers[reg.update].timer:stop()
end
reg.running = false reg.running = false
return reg return reg