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.
next
Michael Stapelberg 2009-09-26 13:47:48 +02:00
parent b898058105
commit 7be41492c6
4 changed files with 13 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -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) {

View File

@ -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;