i3 - improved tiling WM


Consider motif border for floating geometry

Patch status: merged

Patch by Tony Crisci

Long description:

When calculating the geometry of a floating window with motif hints that
specify a border style, take into account that this window will have a
different border style when calculating its position with
floating_enable() when the window becomes managed.

A nice side effect of this is that users can override motif hints with
`new_float` config directives when they are specified other than
`normal`.

fixes #1270

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

b/src/manage.c

23
@@ -436,11 +436,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
24
     if (nc->geometry.width == 0)
25
         nc->geometry = (Rect) {geom->x, geom->y, geom->width, geom->height};
26
 
27
-    if (want_floating) {
28
-        DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height);
29
-        floating_enable(nc, true);
30
-    }
31
-
32
     if (motif_border_style != BS_NORMAL) {
33
         DLOG("MOTIF_WM_HINTS specifies decorations (border_style = %d)\n", motif_border_style);
34
         if (want_floating) {
35
@@ -450,6 +445,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
36
         }
37
     }
38
 
39
+    if (want_floating) {
40
+        DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height);
41
+        /* motif hints will be applied only when `new_float` is `normal` or not
42
+         * specified */
43
+        bool automatic_border = (config.default_floating_border != BS_NORMAL &&
44
+                motif_border_style == BS_NORMAL);
45
+
46
+        floating_enable(nc, automatic_border);
47
+    }
48
+
49
     /* to avoid getting an UnmapNotify event due to reparenting, we temporarily
50
      * declare no interest in any state change event of this window */
51
     values[0] = XCB_NONE;