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

Side by Side Diff: client/deps/glbench/src/xlib_window.cc

Issue 894003: Teartest with -o flag to specify override redirect window and -r number to specify refresh rate. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "main.h" 5 #include "main.h"
6 #include "xlib_window.h" 6 #include "xlib_window.h"
7 7
8 8
9 Display *xlib_display = NULL; 9 Display *xlib_display = NULL;
10 Window xlib_window = 0; 10 Window xlib_window = 0;
11 11
12 GLint g_width = 512; 12 GLint g_width = 512;
13 GLint g_height = 512; 13 GLint g_height = 512;
14 bool g_override_redirect = true;
14 15
15 16
16 bool XlibInit() { 17 bool XlibInit() {
17 xlib_display = ::XOpenDisplay(0); 18 xlib_display = ::XOpenDisplay(0);
18 if (!xlib_display) 19 if (!xlib_display)
19 return false; 20 return false;
20 21
21 int screen = DefaultScreen(xlib_display); 22 int screen = DefaultScreen(xlib_display);
22 Window root_window = RootWindow(xlib_display, screen); 23 Window root_window = RootWindow(xlib_display, screen);
23 24
(...skipping 15 matching lines...) Expand all
39 }; 40 };
40 XVisualInfo *visinfo = glXChooseVisual(xlib_display, screen, attrib); 41 XVisualInfo *visinfo = glXChooseVisual(xlib_display, screen, attrib);
41 unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | 42 unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask |
42 CWOverrideRedirect; 43 CWOverrideRedirect;
43 XSetWindowAttributes attr; 44 XSetWindowAttributes attr;
44 attr.background_pixel = 0; 45 attr.background_pixel = 0;
45 attr.border_pixel = 0; 46 attr.border_pixel = 0;
46 attr.colormap = XCreateColormap(xlib_display, root_window, visinfo->visual, 47 attr.colormap = XCreateColormap(xlib_display, root_window, visinfo->visual,
47 AllocNone); 48 AllocNone);
48 attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; 49 attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
49 attr.override_redirect = True; 50 attr.override_redirect = g_override_redirect ? True : False;
50 xlib_window = ::XCreateWindow(xlib_display, root_window, 51 xlib_window = ::XCreateWindow(xlib_display, root_window,
51 0, 0, g_width, g_height, 0, visinfo->depth, 52 0, 0, g_width, g_height, 0, visinfo->depth,
52 InputOutput, visinfo->visual, mask, &attr); 53 InputOutput, visinfo->visual, mask, &attr);
53 54
54 ::XMapWindow(xlib_display, xlib_window); 55 ::XMapWindow(xlib_display, xlib_window);
55 ::XSync(xlib_display, True); 56 ::XSync(xlib_display, True);
56 57
57 ::XGetWindowAttributes(xlib_display, xlib_window, &attributes); 58 ::XGetWindowAttributes(xlib_display, xlib_window, &attributes);
58 g_width = attributes.width; 59 g_width = attributes.width;
59 g_height = attributes.height; 60 g_height = attributes.height;
60 61
61 return true; 62 return true;
62 } 63 }
63 64
64 65
OLDNEW
« client/deps/glbench/src/teartest.cc ('K') | « client/deps/glbench/src/teartest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698