1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

core: wait for the result xcb_grab_server before doing anything

Make sure X grab server is finished before calling x_discard_events in
session_init. Otherwise x_discard_events won't be able to discard all of
the events that were sent before we grab the server.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-04-19 22:35:52 +01:00
parent bc51fd2c6f
commit 22e3eddbb4
No known key found for this signature in database
GPG key ID: 37C999F617EA1A47

View file

@ -2077,7 +2077,11 @@ 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);
xcb_grab_server(ps->c);
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.
@ -2156,6 +2160,9 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
log_remove_target_tls(stderr_logger);
}
return ps;
err:
free(ps);
return NULL;
}
/**