manage.c: use xcb_discard_reply() instead of free()ing the reply (Thanks psychon)
This commit is contained in:
parent
e3913093b6
commit
e979f16ddb
14
src/manage.c
14
src/manage.c
@ -4,7 +4,7 @@
|
|||||||
* vim:ts=4:sw=4:expandtab
|
* vim:ts=4:sw=4:expandtab
|
||||||
*
|
*
|
||||||
* i3 - an improved dynamic tiling window manager
|
* i3 - an improved dynamic tiling window manager
|
||||||
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
|
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
|
||||||
*
|
*
|
||||||
* manage.c: Initially managing new windows (or existing ones on restart).
|
* manage.c: Initially managing new windows (or existing ones on restart).
|
||||||
*
|
*
|
||||||
@ -122,34 +122,30 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|||||||
|
|
||||||
|
|
||||||
geomc = xcb_get_geometry(conn, d);
|
geomc = xcb_get_geometry(conn, d);
|
||||||
#define FREE_GEOMETRY() do { \
|
|
||||||
if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) != NULL) \
|
|
||||||
free(geom); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Check if the window is mapped (it could be not mapped when intializing and
|
/* Check if the window is mapped (it could be not mapped when intializing and
|
||||||
calling manage_window() for every window) */
|
calling manage_window() for every window) */
|
||||||
if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) {
|
if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) {
|
||||||
DLOG("Could not get attributes\n");
|
DLOG("Could not get attributes\n");
|
||||||
FREE_GEOMETRY();
|
xcb_discard_reply(conn, geomc.sequence);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) {
|
if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) {
|
||||||
FREE_GEOMETRY();
|
xcb_discard_reply(conn, geomc.sequence);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don’t manage clients with the override_redirect flag */
|
/* Don’t manage clients with the override_redirect flag */
|
||||||
if (attr->override_redirect) {
|
if (attr->override_redirect) {
|
||||||
FREE_GEOMETRY();
|
xcb_discard_reply(conn, geomc.sequence);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the window is already managed */
|
/* Check if the window is already managed */
|
||||||
if (con_by_window_id(window) != NULL) {
|
if (con_by_window_id(window) != NULL) {
|
||||||
DLOG("already managed (by con %p)\n", con_by_window_id(window));
|
DLOG("already managed (by con %p)\n", con_by_window_id(window));
|
||||||
FREE_GEOMETRY();
|
xcb_discard_reply(conn, geomc.sequence);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user