naughty: Fix for removal of screen property

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-03-27 16:36:01 +02:00
parent 8453d0cc4f
commit ca5337e731
1 changed files with 6 additions and 6 deletions

View File

@ -196,7 +196,7 @@ end
-- @param notification Notification object to be destroyed -- @param notification Notification object to be destroyed
-- @return True if the popup was successfully destroyed, nil otherwise -- @return True if the popup was successfully destroyed, nil otherwise
function destroy(notification) function destroy(notification)
if notification and notification.box.screen then if notification and notification.box.visible then
if suspended then if suspended then
for k, v in pairs(notifications.suspended) do for k, v in pairs(notifications.suspended) do
if v.box == notification.box then if v.box == notification.box then
@ -205,12 +205,12 @@ function destroy(notification)
end end
end end
end end
local scr = notification.box.screen local scr = notification.screen
table.remove(notifications[notification.box.screen][notification.position], notification.idx) table.remove(notifications[scr][notification.position], notification.idx)
if notification.timer then if notification.timer then
notification.timer:stop() notification.timer:stop()
end end
notification.box.screen = nil notification.box.visible = false
arrange(scr) arrange(scr)
return true return true
end end
@ -305,7 +305,7 @@ function notify(args)
local fg = args.fg or preset.fg or beautiful.fg_normal or '#ffffff' local fg = args.fg or preset.fg or beautiful.fg_normal or '#ffffff'
local bg = args.bg or preset.bg or beautiful.bg_normal or '#535d6c' local bg = args.bg or preset.bg or beautiful.bg_normal or '#535d6c'
local border_color = args.border_color or preset.border_color or beautiful.bg_focus or '#535d6c' local border_color = args.border_color or preset.border_color or beautiful.bg_focus or '#535d6c'
local notification = {} local notification = { screen = screen }
-- replace notification if needed -- replace notification if needed
if args.replaces_id then if args.replaces_id then
@ -469,7 +469,7 @@ function notify(args)
x = offset.x, x = offset.x,
y = offset.y }) y = offset.y })
notification.box.opacity = opacity notification.box.opacity = opacity
notification.box.screen = screen notification.box.visible = true
notification.idx = offset.idx notification.idx = offset.idx
-- populate widgets -- populate widgets