client: change border handling slightly + remove some old cruft
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
62b2273b53
commit
0626d42396
15
client.c
15
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. */
|
||||
|
|
8
screen.c
8
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)
|
||||
|
|
Loading…
Reference in New Issue