awful.screen: fix padding

Signed-off-by: Gregor Best <gbe@intepi.net>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2009-10-07 02:20:39 +02:00 committed by Julien Danjou
parent 8296f58ee7
commit 851889f2b7
2 changed files with 9 additions and 7 deletions

View File

@ -71,7 +71,7 @@ function arrange(screen)
local p = {}
p.workarea = capi.screen[screen].workarea
-- Handle padding
local padding = ascreen.padding(screen)
local padding = ascreen.padding(capi.screen[screen])
if padding then
p.workarea.x = p.workarea.x + (padding.left or 0)
p.workarea.y = p.workarea.y + (padding.top or 0)
@ -140,7 +140,9 @@ for s = 1, capi.screen.count() do
capi.screen[s]:add_signal("tag::detach", function (screen, tag)
arrange(screen.index)
end)
capi.screen[s]:add_signal("padding", arrange)
capi.screen[s]:add_signal("padding", function (screen)
arrange(screen.index)
end)
end
capi.client.add_signal("focus", function(c) arrange(c.screen) end)

View File

@ -39,15 +39,15 @@ function focus_relative(i)
end
--- Get or set the screen padding.
-- @param i The screen number.
-- @param screen The screen object to change the padding on
-- @param padding The padding, an table with 'top', 'left', 'right' and/or
-- 'bottom'. Can be nil if you only want to retrieve padding
function padding(i, padding)
function padding(screen, padding)
if padding then
data.padding[i] = padding
capi.screen[i]:emit_signal("padding")
data.padding[screen] = padding
screen:emit_signal("padding")
end
return data.padding[i]
return data.padding[screen]
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80