From edbc3fa652e2c50342a1ce8a0e8a8b5e486fa276 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 24 Jul 2010 15:29:55 +0200 Subject: [PATCH] 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 --- lib/awful/placement.lua.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/awful/placement.lua.in b/lib/awful/placement.lua.in index 8fa5a05d..26babb6c 100644 --- a/lib/awful/placement.lua.in +++ b/lib/awful/placement.lua.in @@ -105,16 +105,17 @@ end function no_offscreen(c) local c = c or capi.client.focus local geometry = c:geometry() + local border = c.border_width local screen_geometry = capi.screen[c.screen].workarea - if geometry.x + geometry.width > screen_geometry.x + screen_geometry.width then - geometry.x = screen_geometry.x + screen_geometry.width - geometry.width + if geometry.x + geometry.width + 2*border > screen_geometry.x + screen_geometry.width then + geometry.x = screen_geometry.x + screen_geometry.width - geometry.width - 2*border elseif geometry.x < screen_geometry.x then geometry.x = screen_geometry.x end - if geometry.y + geometry.height > screen_geometry.y + screen_geometry.height then - geometry.y = screen_geometry.y + screen_geometry.height - geometry.height + if geometry.y + geometry.height + border > screen_geometry.y + screen_geometry.height then + geometry.y = screen_geometry.y + screen_geometry.height - geometry.height - 2*border elseif geometry.y < screen_geometry.y then geometry.y = screen_geometry.y end