awful.placement: Honor border width

While calculating if part of the window is outside the visible region, this code
should also add the border width. (FS#684)

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-07-24 15:29:55 +02:00
parent e5de0abfb4
commit edbc3fa652
1 changed files with 5 additions and 4 deletions

View File

@ -105,16 +105,17 @@ end
function no_offscreen(c) function no_offscreen(c)
local c = c or capi.client.focus local c = c or capi.client.focus
local geometry = c:geometry() local geometry = c:geometry()
local border = c.border_width
local screen_geometry = capi.screen[c.screen].workarea local screen_geometry = capi.screen[c.screen].workarea
if geometry.x + geometry.width > screen_geometry.x + screen_geometry.width then if geometry.x + geometry.width + 2*border > screen_geometry.x + screen_geometry.width then
geometry.x = screen_geometry.x + screen_geometry.width - geometry.width geometry.x = screen_geometry.x + screen_geometry.width - geometry.width - 2*border
elseif geometry.x < screen_geometry.x then elseif geometry.x < screen_geometry.x then
geometry.x = screen_geometry.x geometry.x = screen_geometry.x
end end
if geometry.y + geometry.height > screen_geometry.y + screen_geometry.height then if geometry.y + geometry.height + border > screen_geometry.y + screen_geometry.height then
geometry.y = screen_geometry.y + screen_geometry.height - geometry.height geometry.y = screen_geometry.y + screen_geometry.height - geometry.height - 2*border
elseif geometry.y < screen_geometry.y then elseif geometry.y < screen_geometry.y then
geometry.y = screen_geometry.y geometry.y = screen_geometry.y
end end