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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. | 91 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0. |
92 UI_EXPORT void UnrefCustomXCursor(::Cursor cursor); | 92 UI_EXPORT void UnrefCustomXCursor(::Cursor cursor); |
93 | 93 |
94 // Creates a XcursorImage and copies the SkBitmap |bitmap| on it. |bitmap| | 94 // Creates a XcursorImage and copies the SkBitmap |bitmap| on it. |bitmap| |
95 // should be non-null. Caller owns the returned object. | 95 // should be non-null. Caller owns the returned object. |
96 UI_EXPORT XcursorImage* SkBitmapToXcursorImage(const SkBitmap* bitmap, | 96 UI_EXPORT XcursorImage* SkBitmapToXcursorImage(const SkBitmap* bitmap, |
97 const gfx::Point& hotspot); | 97 const gfx::Point& hotspot); |
98 #endif | 98 #endif |
99 | 99 |
| 100 // Hides the host cursor. |
| 101 UI_EXPORT void HideHostCursor(); |
| 102 |
| 103 // Returns an invisible cursor. |
| 104 UI_EXPORT ::Cursor CreateInvisibleCursor(); |
| 105 |
100 // These functions do not cache their results -------------------------- | 106 // These functions do not cache their results -------------------------- |
101 | 107 |
102 // Get the X window id for the default root window | 108 // Get the X window id for the default root window |
103 UI_EXPORT XID GetX11RootWindow(); | 109 UI_EXPORT XID GetX11RootWindow(); |
104 | 110 |
105 // Returns the user's current desktop. | 111 // Returns the user's current desktop. |
106 bool GetCurrentDesktop(int* desktop); | 112 bool GetCurrentDesktop(int* desktop); |
107 | 113 |
108 #if defined(TOOLKIT_GTK) | 114 #if defined(TOOLKIT_GTK) |
109 // Get the X window id for the given GTK widget. | 115 // Get the X window id for the given GTK widget. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 ~XScopedString(); | 318 ~XScopedString(); |
313 | 319 |
314 const char* string() const { return string_; } | 320 const char* string() const { return string_; } |
315 | 321 |
316 private: | 322 private: |
317 char* string_; | 323 char* string_; |
318 | 324 |
319 DISALLOW_COPY_AND_ASSIGN(XScopedString); | 325 DISALLOW_COPY_AND_ASSIGN(XScopedString); |
320 }; | 326 }; |
321 | 327 |
| 328 // Keeps track of a cursor returned by an X function and makes sure it's |
| 329 // XFreeCursor'd. |
| 330 class UI_EXPORT XScopedCursor { |
| 331 public: |
| 332 // Keeps track of |cursor| created with |display|. |
| 333 XScopedCursor(::Cursor cursor, Display* display); |
| 334 ~XScopedCursor(); |
| 335 |
| 336 ::Cursor get() const; |
| 337 void reset(::Cursor cursor); |
| 338 |
| 339 private: |
| 340 ::Cursor cursor_; |
| 341 Display* display_; |
| 342 |
| 343 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
| 344 }; |
| 345 |
322 } // namespace ui | 346 } // namespace ui |
323 | 347 |
324 #endif // UI_BASE_X_X11_UTIL_H_ | 348 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |