diff --git a/src/window.c b/src/window.c index 199613c7..9970c1a7 100644 --- a/src/window.c +++ b/src/window.c @@ -1144,6 +1144,29 @@ WWindow *wManageWindow(WScreen *scr, Window window) y -= wwin->frame->top_width + wwin->frame->bottom_width; } + /* wWindowConfigure() will account for the window border + * when placing so the window would be shifted without + * the adjustment below + */ + if (HAS_BORDER(wwin)) { + WMRect rect; + WArea usableArea; + int head; + + rect.pos.x = x; + rect.pos.y = y; + rect.size.width = 1; + rect.size.height = 1; + + head = wGetHeadForRect(scr, rect); + usableArea = wGetUsableAreaForHead(scr, head, NULL, True); + + if (x >= usableArea.x1 + 2 * FRAME_BORDER_WIDTH) + x -= 2 * FRAME_BORDER_WIDTH; + if (y >= usableArea.y1 + 2 * FRAME_BORDER_WIDTH) + y -= 2 * FRAME_BORDER_WIDTH; + } + /* * wWindowConfigure() will init the client window's size * (wwin->client.{width,height}) and all other geometry