naughty: destroy oldest if no room for new popup

Signed-off-by: koniu <gkusnierz@gmail.com>
This commit is contained in:
koniu 2008-10-23 17:47:43 +01:00 committed by Julien Danjou
parent 91dfbbb4eb
commit 71b93f44dd
1 changed files with 7 additions and 0 deletions

View File

@ -120,6 +120,13 @@ local function get_offset(idx, position, lines)
v.y = ws.y + ws.height - (config.margin + config.border_width + config.height*lines + existing)
end
-- if positioned outside workarea, destroy oldest popup and recalculate
if v.y + config.height*lines > ws.y + ws.height or v.y < ws.y then
idx = idx - 1
destroy(notifications[position][1])
v = get_offset(idx, position, lines)
end
return v
end