Improve XSync extension detection

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-01-01 14:09:55 +00:00
parent 428c24a6fa
commit 6413ccbd71
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 7 additions and 2 deletions

View File

@ -2878,8 +2878,13 @@ session_init(session_t *ps_old, int argc, char **argv) {
ps->xsync_error = ext_info->first_error;
ps->xsync_event = ext_info->first_event;
// Need X Sync 3.1 for fences
auto r = xcb_sync_initialize_reply(ps->c, xcb_sync_initialize(ps->c, 3, 1), NULL);
if (r) {
auto r = xcb_sync_initialize_reply(ps->c,
xcb_sync_initialize(ps->c,
XCB_SYNC_MAJOR_VERSION,
XCB_SYNC_MINOR_VERSION),
NULL);
if (r && (r->major_version > 3 ||
(r->major_version == 3 && r->minor_version >= 1))) {
ps->xsync_exists = true;
free(r);
}