From a7d2c5942a155a19263c8910195f4cf99a78b13e Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 2 Jun 2010 17:02:10 +0200 Subject: [PATCH] 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. --- src/manage.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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]))