From 0626d42396a6d0011390595b96804e079aca012c Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sun, 8 Feb 2009 13:48:16 +0100 Subject: [PATCH] client: change border handling slightly + remove some old cruft Signed-off-by: Julien Danjou --- client.c | 15 ++++++++++----- screen.c | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client.c b/client.c index a64a3ace2..d9317cfd2 100644 --- a/client.c +++ b/client.c @@ -475,8 +475,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, c->win = w; c->geometry.x = wgeom->x; c->geometry.y = wgeom->y; - c->geometry.width = wgeom->width + 2 * wgeom->border_width; - c->geometry.height = wgeom->height + 2 * wgeom->border_width; + /* Border will be added later. */ + c->geometry.width = wgeom->width; + c->geometry.height = wgeom->height; /* Also set internal geometry (client_ban() needs it). */ c->geometries.internal.x = wgeom->x; c->geometries.internal.y = wgeom->y; @@ -1176,13 +1177,17 @@ client_setborder(client_t *c, int width) if(width == c->border || width < 0) return; + /* Update geometry with the new border. */ + c->geometry.width -= c->border; + c->geometry.height -= c->border; + c->border = width; xcb_configure_window(globalconf.connection, c->win, XCB_CONFIG_WINDOW_BORDER_WIDTH, &w); - /* Maintain original size of client and also allow titlebar to be properly sized. */ - /* Don't forget that geometry is including border size. */ - client_resize(c, c->geometry, false); + c->geometry.width += c->border; + c->geometry.height += c->border; + /* Tiled clients will be resized by the layout functions. */ client_need_arrange(c); /* Changing border size also affects the size of the titlebar. */ diff --git a/screen.c b/screen.c index bba203d70..e6a3fb039 100644 --- a/screen.c +++ b/screen.c @@ -351,9 +351,9 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) /* resize the client's original geometry if it doesn't fit the screen */ if (new_f_geometry.width > to.width) - new_f_geometry.width = to.width - 2 * c->border; + new_f_geometry.width = to.width; if (new_f_geometry.height > to.height) - new_f_geometry.height = to.height - 2 * c->border; + new_f_geometry.height = to.height; /* make sure the client is still on the screen */ if (new_f_geometry.x + new_f_geometry.width > to.x + to.width) @@ -370,9 +370,9 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) /* resize the client if it doesn't fit the new screen */ if(new_geometry.width > to.width) - new_geometry.width = to.width - 2 * c->border; + new_geometry.width = to.width; if(new_geometry.height > to.height) - new_geometry.height = to.height - 2 * c->border; + new_geometry.height = to.height; /* make sure the client is still on the screen */ if(new_geometry.x + new_geometry.width > to.x + to.width)