From: Michael Stapelberg Date: Wed, 2 Jun 2010 15:02:10 +0000 (+0200) Subject: Clear event mask while reparenting X-Git-Tag: tree-pr1~193 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a7d2c5942a155a19263c8910195f4cf99a78b13e;p=i3%2Fi3 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. --- diff --git a/src/manage.c b/src/manage.c index 7983baac..4305abd1 100644 --- a/src/manage.c +++ b/src/manage.c @@ -124,9 +124,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki LOG("reparenting!\n"); uint32_t mask = 0; 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)); 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); } } + DLOG("new container = %p\n", nc); nc->window = cwindow; 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); if (xcb_request_check(conn, rcookie) != NULL) { LOG("Could not reparent the window, aborting\n"); goto out; } - LOG("ignoring sequence %d for reparenting!\n", rcookie.sequence); - add_ignore_event(rcookie.sequence); + mask = XCB_CW_EVENT_MASK; + 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); if (xcb_reply_contains_atom(reply, atoms[_NET_WM_STATE_FULLSCREEN]))