OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium 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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gfx/gl/gl_context_glx.h" | 9 #include "ui/gfx/gl/gl_context_glx.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 void operator()(void* x) const { | 27 void operator()(void* x) const { |
28 ::XFree(x); | 28 ::XFree(x); |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 bool IsCompositingWindowManagerActive(Display* display) { | 32 bool IsCompositingWindowManagerActive(Display* display) { |
33 // The X macro "None" has been undefined by gl_bindings.h. | 33 // The X macro "None" has been undefined by gl_bindings.h. |
34 const int kNone = 0; | 34 const int kNone = 0; |
35 static Atom net_wm_cm_s0 = kNone; | 35 static Atom net_wm_cm_s0 = kNone; |
36 if (net_wm_cm_s0 == kNone) { | 36 if (net_wm_cm_s0 == static_cast<Atom>(kNone)) { |
37 net_wm_cm_s0 = XInternAtom(display, "_NET_WM_CM_S0", True); | 37 net_wm_cm_s0 = XInternAtom(display, "_NET_WM_CM_S0", True); |
38 } | 38 } |
39 if (net_wm_cm_s0 == kNone) { | 39 if (net_wm_cm_s0 == static_cast<Atom>(kNone)) { |
40 return false; | 40 return false; |
41 } | 41 } |
42 return XGetSelectionOwner(display, net_wm_cm_s0) != kNone; | 42 return XGetSelectionOwner(display, net_wm_cm_s0) != static_cast<Atom>(kNone); |
43 } | 43 } |
44 | 44 |
45 } // namespace anonymous | 45 } // namespace anonymous |
46 | 46 |
47 GLContextGLX::GLContextGLX(GLShareGroup* share_group) | 47 GLContextGLX::GLContextGLX(GLShareGroup* share_group) |
48 : GLContext(share_group), | 48 : GLContext(share_group), |
49 context_(NULL) { | 49 context_(NULL) { |
50 } | 50 } |
51 | 51 |
52 GLContextGLX::~GLContextGLX() { | 52 GLContextGLX::~GLContextGLX() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 static_cast<GLXContext>(context_)); | 117 static_cast<GLXContext>(context_)); |
118 context_ = NULL; | 118 context_ = NULL; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 bool GLContextGLX::MakeCurrent(GLSurface* surface) { | 122 bool GLContextGLX::MakeCurrent(GLSurface* surface) { |
123 DCHECK(context_); | 123 DCHECK(context_); |
124 if (IsCurrent(surface)) | 124 if (IsCurrent(surface)) |
125 return true; | 125 return true; |
126 | 126 |
127 GLSurfaceGLX* surface_glx = static_cast<GLSurfaceGLX*>(surface); | |
128 | |
129 if (!glXMakeCurrent( | 127 if (!glXMakeCurrent( |
130 GLSurfaceGLX::GetDisplay(), | 128 GLSurfaceGLX::GetDisplay(), |
131 reinterpret_cast<GLXDrawable>(surface->GetHandle()), | 129 reinterpret_cast<GLXDrawable>(surface->GetHandle()), |
132 static_cast<GLXContext>(context_))) { | 130 static_cast<GLXContext>(context_))) { |
133 LOG(ERROR) << "Couldn't make context current with X drawable."; | 131 LOG(ERROR) << "Couldn't make context current with X drawable."; |
134 Destroy(); | 132 Destroy(); |
135 return false; | 133 return false; |
136 } | 134 } |
137 | 135 |
138 return true; | 136 return true; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 GLSurfaceGLX::GetDisplay(), | 192 GLSurfaceGLX::GetDisplay(), |
195 0); | 193 0); |
196 if (extensions) { | 194 if (extensions) { |
197 return GLContext::GetExtensions() + " " + extensions; | 195 return GLContext::GetExtensions() + " " + extensions; |
198 } | 196 } |
199 | 197 |
200 return GLContext::GetExtensions(); | 198 return GLContext::GetExtensions(); |
201 } | 199 } |
202 | 200 |
203 } // namespace gfx | 201 } // namespace gfx |
OLD | NEW |