i3 - improved tiling WM


Explicitly set current border width when BS_PIXEL

Patch status: merged

Patch by Tony Crisci

Long description:

When a window becomes managed, if the config specifies a pixel border
style, explicitly set the current border width so it does not change
when the container changes from tiling to floating.

fixes #1266

To apply this patch, use:
curl http://cr.i3wm.org/patch/612/raw.patch | git am

b/src/manage.c

19
@@ -455,6 +455,14 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
20
         floating_enable(nc, automatic_border);
21
     }
22
 
23
+    if (nc->border_style == BS_PIXEL) {
24
+        /* if the border style is BS_PIXEL, explicitly set the border width of
25
+         * the new container */
26
+        nc->current_border_width = (want_floating ?
27
+                config.default_floating_border_width :
28
+                config.default_border_width);
29
+    }
30
+
31
     /* to avoid getting an UnmapNotify event due to reparenting, we temporarily
32
      * declare no interest in any state change event of this window */
33
     values[0] = XCB_NONE;

b/testcases/t/174-border-config.t

38
@@ -66,7 +66,7 @@ $first = open_window;
39
 @content = @{get_ws_content($tmp)};
40
 ok(@content == 1, 'one container opened');
41
 is($content[0]->{border}, 'pixel', 'border pixel by default');
42
-is($content[0]->{current_border_width}, -1, 'border width pixels -1 (default)');
43
+is($content[0]->{current_border_width}, 1, 'border width pixels 1 (default)');
44
 
45
 exit_gracefully($pid);
46