Check map_state value in adopt_orphans

This commit is contained in:
Bastien Dejean 2012-10-24 17:39:15 +02:00
parent 277d7d4131
commit 1a96affd21

10
bspwm.c
View file

@ -63,8 +63,14 @@ void adopt_orphans(void)
if (len == 0)
return;
xcb_window_t *wins = xcb_query_tree_children(qtr);
for (int i = 0; i < len; i++)
manage_window(wins[i]);
for (int i = 0; i < len; i++) {
xcb_get_window_attributes_reply_t *wa = xcb_get_window_attributes_reply(dpy, xcb_get_window_attributes(dpy, wins[i]), NULL);
if (wa != NULL) {
if (wa->map_state == XCB_MAP_STATE_VIEWABLE)
manage_window(wins[i]);
free(wa);
}
}
free(qtr);
}