From: Michael Stapelberg Date: Sat, 26 Sep 2009 11:47:48 +0000 (+0200) Subject: Obey the client’s border_width setting (Thanks shatter) X-Git-Tag: 3.d~78 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7be41492c60e318a6f77fe00ae85b8559c381aa5;p=i3%2Fi3 Obey the client’s border_width setting (Thanks shatter) xterm by default sets a border_width of 2. This was not taken into account when determining the size of the window by i3. Still, you probably want to set this to 0 in your .Xresources as the pixels are just lost. --- diff --git a/include/data.h b/include/data.h index 3f35c595..9d5b841e 100644 --- a/include/data.h +++ b/include/data.h @@ -352,6 +352,9 @@ struct Client { int base_height; int base_width; + /** The amount of pixels which X will draw around the client. */ + int border_width; + /** contains the minimum increment size as specified for the window * (in pixels). */ int width_increment; diff --git a/include/manage.h b/include/manage.h index 10beeb52..65542d91 100644 --- a/include/manage.h +++ b/include/manage.h @@ -42,6 +42,7 @@ void manage_window(xcb_property_handlers_t *prophs, xcb_connection_t *conn, */ void reparent_window(xcb_connection_t *conn, xcb_window_t child, xcb_visualid_t visual, xcb_window_t root, uint8_t depth, - int16_t x, int16_t y, uint16_t width, uint16_t height); + int16_t x, int16_t y, uint16_t width, uint16_t height, + uint32_t border_width); #endif diff --git a/src/layout.c b/src/layout.c index 93d76414..aadc5dd6 100644 --- a/src/layout.c +++ b/src/layout.c @@ -295,6 +295,9 @@ void resize_client(xcb_connection_t *conn, Client *client) { break; } + rect->width -= (2 * client->border_width); + rect->height -= (2 * client->border_width); + /* Obey the ratio, if any */ if (client->proportional_height != 0 && client->proportional_width != 0) { diff --git a/src/manage.c b/src/manage.c index f4eecc96..e2a32416 100644 --- a/src/manage.c +++ b/src/manage.c @@ -99,7 +99,8 @@ void manage_window(xcb_property_handlers_t *prophs, xcb_connection_t *conn, /* Reparent the window and add it to our list of managed windows */ reparent_window(conn, window, attr->visual, geom->root, geom->depth, - geom->x, geom->y, geom->width, geom->height); + geom->x, geom->y, geom->width, geom->height, + geom->border_width); /* Generate callback events for every property we watch */ xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_CLASS); @@ -125,7 +126,8 @@ out: */ void reparent_window(xcb_connection_t *conn, xcb_window_t child, xcb_visualid_t visual, xcb_window_t root, uint8_t depth, - int16_t x, int16_t y, uint16_t width, uint16_t height) { + int16_t x, int16_t y, uint16_t width, uint16_t height, + uint32_t border_width) { xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie, utf8_title_cookie, title_cookie, @@ -175,6 +177,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child, new->rect.height = height; new->width_increment = 1; new->height_increment = 1; + new->border_width = border_width; /* Pre-initialize the values for floating */ new->floating_rect.x = -1; new->floating_rect.width = width;