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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 // Return the shared memory type of our X connection. | 58 // Return the shared memory type of our X connection. |
59 UI_BASE_EXPORT SharedMemorySupport QuerySharedMemorySupport(XDisplay* dpy); | 59 UI_BASE_EXPORT SharedMemorySupport QuerySharedMemorySupport(XDisplay* dpy); |
60 | 60 |
61 // Return true iff the display supports Xrender | 61 // Return true iff the display supports Xrender |
62 UI_BASE_EXPORT bool QueryRenderSupport(XDisplay* dpy); | 62 UI_BASE_EXPORT bool QueryRenderSupport(XDisplay* dpy); |
63 | 63 |
64 // Returns an X11 Cursor, sharable across the process. | 64 // Returns an X11 Cursor, sharable across the process. |
65 // |cursor_shape| is an X font cursor shape, see XCreateFontCursor(). | 65 // |cursor_shape| is an X font cursor shape, see XCreateFontCursor(). |
66 UI_BASE_EXPORT ::Cursor GetXCursor(int cursor_shape); | 66 UI_BASE_EXPORT ::Cursor GetXCursor(int cursor_shape); |
67 | 67 |
68 // Resets the cache used by GetXCursor(). Only useful for tests that may delete | |
69 // the display. | |
70 UI_BASE_EXPORT void ResetXCursorCache(); | |
71 | |
72 // Creates a custom X cursor from the image. This takes ownership of image. The | 68 // Creates a custom X cursor from the image. This takes ownership of image. The |
73 // caller must not free/modify the image. The refcount of the newly created | 69 // caller must not free/modify the image. The refcount of the newly created |
74 // cursor is set to 1. | 70 // cursor is set to 1. |
75 UI_BASE_EXPORT ::Cursor CreateReffedCustomXCursor(XcursorImage* image); | 71 UI_BASE_EXPORT ::Cursor CreateReffedCustomXCursor(XcursorImage* image); |
76 | 72 |
77 // Increases the refcount of the custom cursor. | 73 // Increases the refcount of the custom cursor. |
78 UI_BASE_EXPORT void RefCustomXCursor(::Cursor cursor); | 74 UI_BASE_EXPORT void RefCustomXCursor(::Cursor cursor); |
79 | 75 |
80 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. | 76 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. |
81 UI_BASE_EXPORT void UnrefCustomXCursor(::Cursor cursor); | 77 UI_BASE_EXPORT void UnrefCustomXCursor(::Cursor cursor); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 ::Cursor get() const; | 328 ::Cursor get() const; |
333 void reset(::Cursor cursor); | 329 void reset(::Cursor cursor); |
334 | 330 |
335 private: | 331 private: |
336 ::Cursor cursor_; | 332 ::Cursor cursor_; |
337 XDisplay* display_; | 333 XDisplay* display_; |
338 | 334 |
339 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 335 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
340 }; | 336 }; |
341 | 337 |
338 namespace test { | |
339 // Resets the cache used by GetXCursor(). Only useful for tests that may delete | |
Daniel Erat
2014/05/12 21:19:48
put this in an "#if defined(UNIT_TEST)" section in
oshima
2014/05/12 22:23:42
I don't think this works because this is used in n
Daniel Erat
2014/05/12 23:02:22
ah, never mind then. i was hoping that everything
| |
340 // the display. | |
341 UI_BASE_EXPORT void ResetXCursorCache(); | |
342 | |
343 // Returns the cached XcursorImage for |cursor|. | |
344 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); | |
345 | |
346 } // namespace test | |
347 | |
342 } // namespace ui | 348 } // namespace ui |
343 | 349 |
344 #endif // UI_BASE_X_X11_UTIL_H_ | 350 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |