Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ui/base/x/x11_util.h

Issue 9463003: aura-x11: Add custom web cursor support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: x custom cursor cache Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 // This file declares utility functions for X11 (Linux only). 9 // This file declares utility functions for X11 (Linux only).
10 // 10 //
11 // These functions do not require the Xlib headers to be included (which is why 11 // These functions do not require the Xlib headers to be included (which is why
12 // we use a void* for Visual*). The Xlib headers are highly polluting so we try 12 // we use a void* for Visual*). The Xlib headers are highly polluting so we try
13 // hard to limit their spread into the rest of the code. 13 // hard to limit their spread into the rest of the code.
14 14
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "ui/base/events.h" 19 #include "ui/base/events.h"
20 #include "ui/base/ui_export.h" 20 #include "ui/base/ui_export.h"
21 21
22 typedef unsigned long Atom; 22 typedef unsigned long Atom;
23 typedef unsigned long XID; 23 typedef unsigned long XID;
24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. 24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers.
25 typedef struct _XDisplay Display; 25 typedef struct _XDisplay Display;
26 typedef unsigned long Cursor; 26 typedef unsigned long Cursor;
27 typedef struct _XcursorImage XcursorImage;
27 28
28 #if defined(TOOLKIT_USES_GTK) 29 #if defined(TOOLKIT_USES_GTK)
29 typedef struct _GdkDrawable GdkWindow; 30 typedef struct _GdkDrawable GdkWindow;
30 typedef struct _GtkWidget GtkWidget; 31 typedef struct _GtkWidget GtkWidget;
31 typedef struct _GtkWindow GtkWindow; 32 typedef struct _GtkWindow GtkWindow;
32 #endif 33 #endif
33 34
34 namespace gfx { 35 namespace gfx {
35 class Rect; 36 class Rect;
36 } 37 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 int GetDefaultScreen(Display* display); 71 int GetDefaultScreen(Display* display);
71 72
72 // TODO(xiyuan): Fix the stale XCursorCache problem per http://crbug.com/102759. 73 // TODO(xiyuan): Fix the stale XCursorCache problem per http://crbug.com/102759.
73 // A special cursor that makes GetXCursor below to clear its XCursorCache. 74 // A special cursor that makes GetXCursor below to clear its XCursorCache.
74 const int kCursorClearXCursorCache = -1; 75 const int kCursorClearXCursorCache = -1;
75 76
76 // Returns an X11 Cursor, sharable across the process. 77 // Returns an X11 Cursor, sharable across the process.
77 // |cursor_shape| is an X font cursor shape, see XCreateFontCursor(). 78 // |cursor_shape| is an X font cursor shape, see XCreateFontCursor().
78 UI_EXPORT Cursor GetXCursor(int cursor_shape); 79 UI_EXPORT Cursor GetXCursor(int cursor_shape);
79 80
81 #if defined(USE_AURA)
82 // Creates a custom X cursor from the image. This takes ownership of image. The
83 // caller must not free/modify the image. The refcount of the newly created
84 // cursor is set to 1.
85 UI_EXPORT Cursor CreateReffedCustomXCursor(XcursorImage* image);
Daniel Erat 2012/02/24 21:04:36 will defer to others on "Reffed" vs. "Refed" vs. "
86
87 // Increases the refcount of the custom cursor.
88 UI_EXPORT void RefCustomXCursor(Cursor cursor);
89
90 // Decreases the refcount of the custom cursor, and destroys it if it reaches 0.
91 UI_EXPORT void UnrefCustomXCursor(Cursor cursor);
92 #endif
93
80 // These functions do not cache their results -------------------------- 94 // These functions do not cache their results --------------------------
81 95
82 // Get the X window id for the default root window 96 // Get the X window id for the default root window
83 UI_EXPORT XID GetX11RootWindow(); 97 UI_EXPORT XID GetX11RootWindow();
84 98
85 // Returns the user's current desktop. 99 // Returns the user's current desktop.
86 bool GetCurrentDesktop(int* desktop); 100 bool GetCurrentDesktop(int* desktop);
87 101
88 #if defined(TOOLKIT_USES_GTK) 102 #if defined(TOOLKIT_USES_GTK)
89 // Get the X window id for the given GTK widget. 103 // Get the X window id for the given GTK widget.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 280
267 private: 281 private:
268 char* string_; 282 char* string_;
269 283
270 DISALLOW_COPY_AND_ASSIGN(XScopedString); 284 DISALLOW_COPY_AND_ASSIGN(XScopedString);
271 }; 285 };
272 286
273 } // namespace ui 287 } // namespace ui
274 288
275 #endif // UI_BASE_X_X11_UTIL_H_ 289 #endif // UI_BASE_X_X11_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698