| 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 #ifndef UI_BASE_X_X11_UTIL_H_ | 5 #ifndef UI_BASE_X_X11_UTIL_H_ |
| 6 #define UI_BASE_X_X11_UTIL_H_ | 6 #define UI_BASE_X_X11_UTIL_H_ |
| 7 | 7 |
| 8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
| 9 // | 9 // |
| 10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // the UI thread. Thus, they don't support multiple displays. | 41 // the UI thread. Thus, they don't support multiple displays. |
| 42 | 42 |
| 43 // These functions cache their results --------------------------------- | 43 // These functions cache their results --------------------------------- |
| 44 | 44 |
| 45 // Returns true if the system supports XINPUT2. | 45 // Returns true if the system supports XINPUT2. |
| 46 UI_BASE_X_EXPORT bool IsXInput2Available(); | 46 UI_BASE_X_EXPORT bool IsXInput2Available(); |
| 47 | 47 |
| 48 // Return true iff the display supports Xrender | 48 // Return true iff the display supports Xrender |
| 49 UI_BASE_X_EXPORT bool QueryRenderSupport(XDisplay* dpy); | 49 UI_BASE_X_EXPORT bool QueryRenderSupport(XDisplay* dpy); |
| 50 | 50 |
| 51 // Returns an X11 Cursor, sharable across the process. | |
| 52 // |cursor_shape| is an X font cursor shape, see XCreateFontCursor(). | |
| 53 UI_BASE_X_EXPORT::Cursor GetXCursor(int cursor_shape); | |
| 54 | |
| 55 // Creates a custom X cursor from the image. This takes ownership of image. The | 51 // Creates a custom X cursor from the image. This takes ownership of image. The |
| 56 // caller must not free/modify the image. The refcount of the newly created | 52 // caller must not free/modify the image. The refcount of the newly created |
| 57 // cursor is set to 1. | 53 // cursor is set to 1. |
| 58 UI_BASE_X_EXPORT::Cursor CreateReffedCustomXCursor(XcursorImage* image); | 54 UI_BASE_X_EXPORT::Cursor CreateReffedCustomXCursor(XcursorImage* image); |
| 59 | 55 |
| 60 // Increases the refcount of the custom cursor. | 56 // Increases the refcount of the custom cursor. |
| 61 UI_BASE_X_EXPORT void RefCustomXCursor(::Cursor cursor); | 57 UI_BASE_X_EXPORT void RefCustomXCursor(::Cursor cursor); |
| 62 | 58 |
| 63 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. | 59 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. |
| 64 UI_BASE_X_EXPORT void UnrefCustomXCursor(::Cursor cursor); | 60 UI_BASE_X_EXPORT void UnrefCustomXCursor(::Cursor cursor); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void reset(::Cursor cursor); | 317 void reset(::Cursor cursor); |
| 322 | 318 |
| 323 private: | 319 private: |
| 324 ::Cursor cursor_; | 320 ::Cursor cursor_; |
| 325 XDisplay* display_; | 321 XDisplay* display_; |
| 326 | 322 |
| 327 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 323 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
| 328 }; | 324 }; |
| 329 | 325 |
| 330 namespace test { | 326 namespace test { |
| 331 // Resets the cache used by GetXCursor(). Only useful for tests that may delete | |
| 332 // the display. | |
| 333 UI_BASE_X_EXPORT void ResetXCursorCache(); | |
| 334 | 327 |
| 335 // Returns the cached XcursorImage for |cursor|. | 328 // Returns the cached XcursorImage for |cursor|. |
| 336 UI_BASE_X_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); | 329 UI_BASE_X_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); |
| 337 | 330 |
| 338 } // namespace test | 331 } // namespace test |
| 339 | 332 |
| 340 } // namespace ui | 333 } // namespace ui |
| 341 | 334 |
| 342 #endif // UI_BASE_X_X11_UTIL_H_ | 335 #endif // UI_BASE_X_X11_UTIL_H_ |
| OLD | NEW |