naughty: fix timeout = 0

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-20 18:07:30 +02:00
parent 8c8c260ceb
commit 2fda9f5a2e
1 changed files with 14 additions and 7 deletions

View File

@ -174,7 +174,9 @@ function destroy(notification)
if notification and notification.box.screen then if notification and notification.box.screen then
local scr = notification.box.screen local scr = notification.box.screen
table.remove(notifications[notification.box.screen][notification.position], notification.idx) table.remove(notifications[notification.box.screen][notification.position], notification.idx)
if notification.timer then
notification.timer:stop() notification.timer:stop()
end
notification.box.screen = nil notification.box.screen = nil
arrange(scr) arrange(scr)
return true return true
@ -292,12 +294,14 @@ function notify(args)
if title then title = title .. "\n" else title = "" end if title then title = title .. "\n" else title = "" end
-- hook destroy -- hook destroy
local timer_die = capi.timer { timeout = timeout }
local die = function () destroy(notification) end local die = function () destroy(notification) end
if timeout > 0 then
local timer_die = capi.timer { timeout = timeout }
timer_die:add_signal("timeout", die) timer_die:add_signal("timeout", die)
timer_die:start() timer_die:start()
notification.die = die
notification.timer = timer_die notification.timer = timer_die
end
notification.die = die
local run = function () local run = function ()
if args.run then if args.run then
@ -308,8 +312,11 @@ function notify(args)
end end
local hover_destroy = function () local hover_destroy = function ()
if hover_timeout == 0 then die() if hover_timeout == 0 then
else timer_die:stop() end die()
elseif timer_die then
timer_die:stop()
end
end end
-- create textbox -- create textbox