Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1476)

Unified Diff: client/deps/glbench/src/xlib_window.cc

Issue 1168005: Initialization cleanups and couple other minor things: (Closed)
Patch Set: fixes Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/deps/glbench/src/xlib_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ae17fe4e7f28c0351047e96441255b11e4fbed47..ff995e7312c4ee053042a31d3d5cbaabb05d5915 100644
--- a/client/deps/glbench/src/xlib_window.cc
+++ b/client/deps/glbench/src/xlib_window.cc
@@ -4,10 +4,12 @@
#include "main.h"
#include "xlib_window.h"
+#include "base/logging.h"
Display *xlib_display = NULL;
Window xlib_window = 0;
+XVisualInfo *xlib_visinfo = NULL;
GLint g_width = 512;
GLint g_height = 512;
@@ -15,7 +17,7 @@ bool g_override_redirect = true;
bool XlibInit() {
- xlib_display = ::XOpenDisplay(0);
+ xlib_display = XOpenDisplay(0);
if (!xlib_display)
return false;
@@ -28,38 +30,33 @@ bool XlibInit() {
g_width = g_width == -1 ? attributes.width : g_width;
g_height = g_height == -1 ? attributes.height : g_height;
- int attrib[] = {
- GLX_RGBA,
- GLX_DOUBLEBUFFER, 1,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE, 1,
- GLX_STENCIL_SIZE, 1,
- None
- };
- XVisualInfo *visinfo = glXChooseVisual(xlib_display, screen, attrib);
+ XVisualInfo vinfo_template;
+ memset(&vinfo_template, sizeof(vinfo_template), 0);
+ vinfo_template.visualid = GetVisualID();
+ int nitems;
+ xlib_visinfo = XGetVisualInfo(xlib_display,
+ VisualIDMask, &vinfo_template, &nitems);
+ CHECK(nitems == 1);
+
unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask |
CWOverrideRedirect;
XSetWindowAttributes attr;
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap(xlib_display, root_window, visinfo->visual,
- AllocNone);
+ attr.colormap = XCreateColormap(xlib_display, root_window,
+ xlib_visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = g_override_redirect ? True : False;
- xlib_window = ::XCreateWindow(xlib_display, root_window,
- 0, 0, g_width, g_height, 0, visinfo->depth,
- InputOutput, visinfo->visual, mask, &attr);
+ xlib_window = XCreateWindow(xlib_display, root_window,
+ 0, 0, g_width, g_height, 0, xlib_visinfo->depth,
+ InputOutput, xlib_visinfo->visual, mask, &attr);
- ::XMapWindow(xlib_display, xlib_window);
- ::XSync(xlib_display, True);
+ XMapWindow(xlib_display, xlib_window);
+ XSync(xlib_display, True);
- ::XGetWindowAttributes(xlib_display, xlib_window, &attributes);
+ XGetWindowAttributes(xlib_display, xlib_window, &attributes);
g_width = attributes.width;
g_height = attributes.height;
return true;
}
-
-
« no previous file with comments | « client/deps/glbench/src/xlib_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698