Fix "epoxy_glx_version" to handle the case when GLX is not active on the display.

macos/v1.5.9
Yaron Cohen-Tal 9 years ago
parent 7d1c96c85f
commit b3b8bd9af7
  1. 25
      src/dispatch_glx.c

@ -54,22 +54,23 @@ epoxy_glx_version(Display *dpy, int screen)
int client_major, client_minor; int client_major, client_minor;
int server, client; int server, client;
const char *version_string; const char *version_string;
int ret; int ret=0, sscanf_ret;
version_string = glXQueryServerString(dpy, screen, GLX_VERSION); if ((version_string = glXQueryServerString(dpy, screen, GLX_VERSION)))
ret = sscanf(version_string, "%d.%d", &server_major, &server_minor); {
assert(ret == 2); sscanf_ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
assert(sscanf_ret == 2);
server = server_major * 10 + server_minor; server = server_major * 10 + server_minor;
if ((version_string = glXGetClientString(dpy, GLX_VERSION)))
version_string = glXGetClientString(dpy, GLX_VERSION); {
ret = sscanf(version_string, "%d.%d", &client_major, &client_minor); sscanf_ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
assert(ret == 2); assert(sscanf_ret == 2);
client = client_major * 10 + client_minor; client = client_major * 10 + client_minor;
ret = client <= server ? client : server;
}
}
if (client < server) return ret;
return client;
else
return server;
} }
/** /**

Loading…
Cancel
Save