OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 | 293 |
294 if (shared_memory_support_cached) | 294 if (shared_memory_support_cached) |
295 return shared_memory_support; | 295 return shared_memory_support; |
296 | 296 |
297 shared_memory_support = DoQuerySharedMemorySupport(dpy); | 297 shared_memory_support = DoQuerySharedMemorySupport(dpy); |
298 shared_memory_support_cached = true; | 298 shared_memory_support_cached = true; |
299 | 299 |
300 return shared_memory_support; | 300 return shared_memory_support; |
301 } | 301 } |
302 | 302 |
303 bool QueryRenderSupport(Display* dpy) { | |
304 static bool render_supported = false; | |
305 static bool render_supported_cached = false; | |
306 | |
307 if (render_supported_cached) | |
308 return render_supported; | |
309 | |
310 // We don't care about the version of Xrender since all the features which | |
311 // we use are included in every version. | |
312 int dummy; | |
313 render_supported = XRenderQueryExtension(dpy, &dummy, &dummy); | |
sadrul
2014/05/02 01:35:45
I think you can use a single static bool. See IsSh
| |
314 render_supported_cached = true; | |
315 | |
316 return render_supported; | |
317 } | |
318 | |
303 ::Cursor GetXCursor(int cursor_shape) { | 319 ::Cursor GetXCursor(int cursor_shape) { |
304 if (!cursor_cache) | 320 if (!cursor_cache) |
305 cursor_cache = new XCursorCache; | 321 cursor_cache = new XCursorCache; |
306 return cursor_cache->GetCursor(cursor_shape); | 322 return cursor_cache->GetCursor(cursor_shape); |
307 } | 323 } |
308 | 324 |
309 void ResetXCursorCache() { | 325 void ResetXCursorCache() { |
310 delete cursor_cache; | 326 delete cursor_cache; |
311 cursor_cache = NULL; | 327 cursor_cache = NULL; |
312 } | 328 } |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1348 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1364 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1349 << "minor_code " << static_cast<int>(error_event.minor_code) | 1365 << "minor_code " << static_cast<int>(error_event.minor_code) |
1350 << " (" << request_str << ")"; | 1366 << " (" << request_str << ")"; |
1351 } | 1367 } |
1352 | 1368 |
1353 // ---------------------------------------------------------------------------- | 1369 // ---------------------------------------------------------------------------- |
1354 // End of x11_util_internal.h | 1370 // End of x11_util_internal.h |
1355 | 1371 |
1356 | 1372 |
1357 } // namespace ui | 1373 } // namespace ui |
OLD | NEW |