i3 - improved tiling WM


Reply to _NET_REQUEST_FRAME_EXTENTS correctly

Patch status: needinfo

Patch by Tony Crisci

Long description:

Reply to _NET_REQUEST_FRAME_EXTENTS by setting _NET_FRAME_EXTENTS property of the window to widths of the respective borders added by the Window Manager.

Fixes #1093

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

b/src/handlers.c

16
@@ -709,32 +709,14 @@ static void handle_client_message(xcb_client_message_event_t *event) {
17
         // A client can request an estimate for the frame size which the window
18
         // manager will put around it before actually mapping its window. Java
19
         // does this (as of openjdk-7).
20
-        //
21
-        // Note that the calculation below is not entirely accurate — once you
22
-        // set a different border type, it’s off. We _could_ request all the
23
-        // window properties (which have to be set up at this point according
24
-        // to EWMH), but that seems rather elaborate. The standard explicitly
25
-        // says the application must cope with an estimate that is not entirely
26
-        // accurate.
27
         DLOG("_NET_REQUEST_FRAME_EXTENTS for window 0x%08x\n", event->window);
28
-        xcb_get_geometry_reply_t *geometry;
29
-        xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, event->window);
30
-
31
-        if (!(geometry = xcb_get_geometry_reply(conn, cookie, NULL))) {
32
-            ELOG("Could not get geometry of X11 window 0x%08x while handling "
33
-                 "the _NET_REQUEST_FRAME_EXTENTS ClientMessage\n",
34
-                 event->window);
35
-            return;
36
-        }
37
-
38
-        DLOG("Current geometry = x=%d, y=%d, width=%d, height=%d\n",
39
-             geometry->x, geometry->y, geometry->width, geometry->height);
40
 
41
+        /* Approximate widths of the respective borders added by the Window Manager. */
42
         Rect r = {
43
-            0, // left
44
-            geometry->width + 4, // right
45
-            0, // top
46
-            geometry->height + config.font.height + 5, // bottom
47
+            1, // left
48
+            1, // right
49
+            config.font.height + 5, // top
50
+            1 // bottom
51
         };
52
         xcb_change_property(
53
                 conn,