Clear event mask while reparenting

This way, we can avoid to ignore UnmapNotify events generated by reparenting.
It is generally considerable to have as little ignored events as possible
due to side-effects.
This commit is contained in:
Michael Stapelberg 2010-06-02 17:02:10 +02:00
parent c1789bef8e
commit a7d2c5942a

View File

@ -124,9 +124,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
LOG("reparenting!\n"); LOG("reparenting!\n");
uint32_t mask = 0; uint32_t mask = 0;
uint32_t values[1]; uint32_t values[1];
mask = XCB_CW_EVENT_MASK;
values[0] = CHILD_EVENT_MASK;
xcb_change_window_attributes(conn, window, mask, values);
i3Window *cwindow = scalloc(sizeof(i3Window)); i3Window *cwindow = scalloc(sizeof(i3Window));
cwindow->id = window; cwindow->id = window;
@ -162,17 +159,24 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
nc = tree_open_con(nc->parent); nc = tree_open_con(nc->parent);
} }
} }
DLOG("new container = %p\n", nc);
nc->window = cwindow; nc->window = cwindow;
x_reinit(nc); x_reinit(nc);
/* to avoid getting an UnmapNotify event due to reparenting, we temporarily
* declare no interest in any state change event of this window */
values[0] = XCB_NONE;
xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values);
xcb_void_cookie_t rcookie = xcb_reparent_window_checked(conn, window, nc->frame, 0, 0); xcb_void_cookie_t rcookie = xcb_reparent_window_checked(conn, window, nc->frame, 0, 0);
if (xcb_request_check(conn, rcookie) != NULL) { if (xcb_request_check(conn, rcookie) != NULL) {
LOG("Could not reparent the window, aborting\n"); LOG("Could not reparent the window, aborting\n");
goto out; goto out;
} }
LOG("ignoring sequence %d for reparenting!\n", rcookie.sequence); mask = XCB_CW_EVENT_MASK;
add_ignore_event(rcookie.sequence); values[0] = CHILD_EVENT_MASK;
xcb_change_window_attributes(conn, window, mask, values);
xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, state_cookie, NULL); xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, state_cookie, NULL);
if (xcb_reply_contains_atom(reply, atoms[_NET_WM_STATE_FULLSCREEN])) if (xcb_reply_contains_atom(reply, atoms[_NET_WM_STATE_FULLSCREEN]))