awful.placement.no_offscreen: Fix border handling (FS#1065)
The (x,y) position of a client is outside of the border, but the width/height does not include the border (so the real width is width+2*border). This means that we have to also subtract 2*border to make sure that the client including its border really is inside of the expected area. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
fdfb7c5bb5
commit
7d1a963352
|
@ -108,17 +108,17 @@ function placement.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 screen = c.screen or a_screen.getbycoord(geometry.x, geometry.y)
|
local screen = c.screen or a_screen.getbycoord(geometry.x, geometry.y)
|
||||||
local border = c.border_width
|
local border = c.border_width
|
||||||
local screen_geometry = capi.screen[screen].workarea
|
local screen_geometry = capi.screen[screen].workarea
|
||||||
|
|
||||||
if geometry.x + geometry.width + 2*border > 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 + border > 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
|
||||||
|
|
Loading…
Reference in New Issue