Index: client/deps/glbench/src/xlib_window.cc |
diff --git a/client/deps/glbench/src/xlib_window.cc b/client/deps/glbench/src/xlib_window.cc |
index 82a1ae7593b065af408a96fd00e4361563046590..0958b5c552164caf10b5c525d59cacdaca554a07 100644 |
--- a/client/deps/glbench/src/xlib_window.cc |
+++ b/client/deps/glbench/src/xlib_window.cc |
@@ -9,7 +9,6 @@ |
Display *g_xlib_display = NULL; |
Window g_xlib_window = 0; |
-XVisualInfo *g_xlib_visinfo = NULL; |
GLint g_width = 512; |
GLint g_height = 512; |
@@ -29,14 +28,7 @@ bool XlibInit() { |
g_width = g_width == -1 ? attributes.width : g_width; |
g_height = g_height == -1 ? attributes.height : g_height; |
- |
- XVisualInfo vinfo_template; |
- memset(&vinfo_template, sizeof(vinfo_template), 0); |
- vinfo_template.visualid = GetVisualID(); |
- int nitems; |
- g_xlib_visinfo = XGetVisualInfo(g_xlib_display, |
- VisualIDMask, &vinfo_template, &nitems); |
- CHECK(nitems == 1); |
+ XVisualInfo* xlib_visinfo = GetXVisual(); |
unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | |
CWOverrideRedirect; |
@@ -44,13 +36,13 @@ bool XlibInit() { |
attr.background_pixel = 0; |
attr.border_pixel = 0; |
attr.colormap = XCreateColormap(g_xlib_display, root_window, |
- g_xlib_visinfo->visual, AllocNone); |
+ xlib_visinfo->visual, AllocNone); |
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; |
attr.override_redirect = g_override_redirect ? True : False; |
g_xlib_window = XCreateWindow(g_xlib_display, root_window, |
0, 0, g_width, g_height, 0, |
- g_xlib_visinfo->depth, InputOutput, |
- g_xlib_visinfo->visual, mask, &attr); |
+ xlib_visinfo->depth, InputOutput, |
+ xlib_visinfo->visual, mask, &attr); |
XMapWindow(g_xlib_display, g_xlib_window); |
XSync(g_xlib_display, True); |
@@ -59,5 +51,7 @@ bool XlibInit() { |
g_width = attributes.width; |
g_height = attributes.height; |
+ XFree(xlib_visinfo); |
+ |
return true; |
} |