]> git.sur5r.net Git - i3/i3/commitdiff
Obey the client’s border_width setting (Thanks shatter)
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 26 Sep 2009 11:47:48 +0000 (13:47 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 26 Sep 2009 11:47:48 +0000 (13:47 +0200)
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.

include/data.h
include/manage.h
src/layout.c
src/manage.c

index 3f35c595c08e57f28bea9db17ecb999c316fd344..9d5b841e2000709e461ad7206cc96d95980382e1 100644 (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;
index 10beeb525c523b61724d9309cd3311543a569962..65542d91c088ad0253c46365d8a89cda50aaa7cf 100644 (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
index 93d76414691e8dafb110c45eae082d961f99ad99..aadc5dd6522c76be472ea4460996f8c49de24dc0 100644 (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) {
index f4eecc966be9353dfa325537acb14620a14269fd..e2a32416615a3fe99848e2aed227faa656c22336 100644 (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;