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

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

Issue 1208001: Renamed globals xlib_* to g_xlib_*. (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
« no previous file with comments | « client/deps/glbench/src/xlib_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h"
5 #include "main.h" 6 #include "main.h"
6 #include "xlib_window.h" 7 #include "xlib_window.h"
7 #include "base/logging.h"
8 8
9 9
10 Display *xlib_display = NULL; 10 Display *g_xlib_display = NULL;
11 Window xlib_window = 0; 11 Window g_xlib_window = 0;
12 XVisualInfo *xlib_visinfo = NULL; 12 XVisualInfo *g_xlib_visinfo = NULL;
13 13
14 GLint g_width = 512; 14 GLint g_width = 512;
15 GLint g_height = 512; 15 GLint g_height = 512;
16 bool g_override_redirect = true; 16 bool g_override_redirect = true;
17 17
18 18
19 bool XlibInit() { 19 bool XlibInit() {
20 xlib_display = XOpenDisplay(0); 20 g_xlib_display = XOpenDisplay(0);
21 if (!xlib_display) 21 if (!g_xlib_display)
22 return false; 22 return false;
23 23
24 int screen = DefaultScreen(xlib_display); 24 int screen = DefaultScreen(g_xlib_display);
25 Window root_window = RootWindow(xlib_display, screen); 25 Window root_window = RootWindow(g_xlib_display, screen);
26 26
27 XWindowAttributes attributes; 27 XWindowAttributes attributes;
28 XGetWindowAttributes(xlib_display, root_window, &attributes); 28 XGetWindowAttributes(g_xlib_display, root_window, &attributes);
29 29
30 g_width = g_width == -1 ? attributes.width : g_width; 30 g_width = g_width == -1 ? attributes.width : g_width;
31 g_height = g_height == -1 ? attributes.height : g_height; 31 g_height = g_height == -1 ? attributes.height : g_height;
32 32
33 XVisualInfo vinfo_template; 33 XVisualInfo vinfo_template;
34 memset(&vinfo_template, sizeof(vinfo_template), 0); 34 memset(&vinfo_template, sizeof(vinfo_template), 0);
35 vinfo_template.visualid = GetVisualID(); 35 vinfo_template.visualid = GetVisualID();
36 int nitems; 36 int nitems;
37 xlib_visinfo = XGetVisualInfo(xlib_display, 37 g_xlib_visinfo = XGetVisualInfo(g_xlib_display,
38 VisualIDMask, &vinfo_template, &nitems); 38 VisualIDMask, &vinfo_template, &nitems);
39 CHECK(nitems == 1); 39 CHECK(nitems == 1);
40 40
41 unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | 41 unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask |
42 CWOverrideRedirect; 42 CWOverrideRedirect;
43 XSetWindowAttributes attr; 43 XSetWindowAttributes attr;
44 attr.background_pixel = 0; 44 attr.background_pixel = 0;
45 attr.border_pixel = 0; 45 attr.border_pixel = 0;
46 attr.colormap = XCreateColormap(xlib_display, root_window, 46 attr.colormap = XCreateColormap(g_xlib_display, root_window,
47 xlib_visinfo->visual, AllocNone); 47 g_xlib_visinfo->visual, AllocNone);
48 attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; 48 attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
49 attr.override_redirect = g_override_redirect ? True : False; 49 attr.override_redirect = g_override_redirect ? True : False;
50 xlib_window = XCreateWindow(xlib_display, root_window, 50 g_xlib_window = XCreateWindow(g_xlib_display, root_window,
51 0, 0, g_width, g_height, 0, xlib_visinfo->depth, 51 0, 0, g_width, g_height, 0,
52 InputOutput, xlib_visinfo->visual, mask, &attr); 52 g_xlib_visinfo->depth, InputOutput,
53 g_xlib_visinfo->visual, mask, &attr);
53 54
54 XMapWindow(xlib_display, xlib_window); 55 XMapWindow(g_xlib_display, g_xlib_window);
55 XSync(xlib_display, True); 56 XSync(g_xlib_display, True);
56 57
57 XGetWindowAttributes(xlib_display, xlib_window, &attributes); 58 XGetWindowAttributes(g_xlib_display, g_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 }
OLDNEW
« 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