diff --git a/src/compton.c b/src/compton.c index 92797a9..3ed6c9a 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1969,18 +1969,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, ev_set_priority(&ps->event_check, EV_MINPRI); ev_prepare_start(ps->loop, &ps->event_check); - e = xcb_request_check(ps->c, xcb_grab_server_checked(ps->c)); - if (e) { - log_fatal("Failed to grab X server"); - goto err; - } - - // We are going to pull latest information from X server now, events sent by X - // earlier is irrelavant at this point. - // A better solution is probably grabbing the server from the very start. But I - // think there still could be race condition that mandates discarding the events. - x_discard_events(ps->c); - // Initialize DBus. We need to do this early, because add_win might call dbus // functions if (ps->o.dbus) { @@ -1995,6 +1983,18 @@ static session_t *session_init(int argc, char **argv, Display *dpy, #endif } + e = xcb_request_check(ps->c, xcb_grab_server_checked(ps->c)); + if (e) { + log_fatal("Failed to grab X server"); + goto err; + } + + // We are going to pull latest information from X server now, events sent by X + // earlier is irrelavant at this point. + // A better solution is probably grabbing the server from the very start. But I + // think there still could be race condition that mandates discarding the events. + x_discard_events(ps->c); + { xcb_window_t *children; int nchildren;