Reply to _NET_REQUEST_FRAME_EXTENTS correctly

Reply to _NET_REQUEST_FRAME_EXTENTS by settings _NET_FRAME_EXTENTS
property of the window to widths of the respective borders added by i3.

fixes #1093
fixes #1069
This commit is contained in:
Tony Crisci 2013-10-09 12:49:15 -04:00 committed by Michael Stapelberg
parent 04847eeb1f
commit 05e46848f0

View File

@ -706,35 +706,26 @@ static void handle_client_message(xcb_client_message_event_t *event) {
xcb_flush(conn); xcb_flush(conn);
free(reply); free(reply);
} else if (event->type == A__NET_REQUEST_FRAME_EXTENTS) { } else if (event->type == A__NET_REQUEST_FRAME_EXTENTS) {
// A client can request an estimate for the frame size which the window /*
// manager will put around it before actually mapping its window. Java * A client can request an estimate for the frame size which the window
// does this (as of openjdk-7). * manager will put around it before actually mapping its window. Java
// * does this (as of openjdk-7).
// Note that the calculation below is not entirely accurate — once you *
// set a different border type, its off. We _could_ request all the * Note that the calculation below is not entirely accurate once you
// window properties (which have to be set up at this point according * set a different border type, its off. We _could_ request all the
// to EWMH), but that seems rather elaborate. The standard explicitly * window properties (which have to be set up at this point according
// says the application must cope with an estimate that is not entirely * to EWMH), but that seems rather elaborate. The standard explicitly
// accurate. * says the application must cope with an estimate that is not entirely
* accurate.
*/
DLOG("_NET_REQUEST_FRAME_EXTENTS for window 0x%08x\n", event->window); DLOG("_NET_REQUEST_FRAME_EXTENTS for window 0x%08x\n", event->window);
xcb_get_geometry_reply_t *geometry;
xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, event->window);
if (!(geometry = xcb_get_geometry_reply(conn, cookie, NULL))) {
ELOG("Could not get geometry of X11 window 0x%08x while handling "
"the _NET_REQUEST_FRAME_EXTENTS ClientMessage\n",
event->window);
return;
}
DLOG("Current geometry = x=%d, y=%d, width=%d, height=%d\n",
geometry->x, geometry->y, geometry->width, geometry->height);
/* The reply data: approximate frame size */
Rect r = { Rect r = {
0, // left config.default_border_width, /* left */
geometry->width + 4, // right config.default_border_width, /* right */
0, // top config.font.height + 5, /* top */
geometry->height + config.font.height + 5, // bottom config.default_border_width /* bottom */
}; };
xcb_change_property( xcb_change_property(
conn, conn,