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

Side by Side Diff: webkit/glue/webcursor.h

Issue 9463003: aura-x11: Add custom web cursor support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 WEBKIT_GLUE_WEBCURSOR_H_ 5 #ifndef WEBKIT_GLUE_WEBCURSOR_H_
6 #define WEBKIT_GLUE_WEBCURSOR_H_ 6 #define WEBKIT_GLUE_WEBCURSOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/gfx/native_widget_types.h" 9 #include "ui/gfx/native_widget_types.h"
10 #include "ui/gfx/point.h" 10 #include "ui/gfx/point.h"
(...skipping 11 matching lines...) Expand all
22 #elif defined(OS_MACOSX) 22 #elif defined(OS_MACOSX)
23 #ifdef __OBJC__ 23 #ifdef __OBJC__
24 @class NSCursor; 24 @class NSCursor;
25 #else 25 #else
26 class NSCursor; 26 class NSCursor;
27 #endif 27 #endif
28 typedef UInt32 ThemeCursor; 28 typedef UInt32 ThemeCursor;
29 struct Cursor; 29 struct Cursor;
30 #endif 30 #endif
31 31
32 #if defined(USE_AURA) && defined(USE_X11)
33 typedef struct _XcursorImage XcursorImage;
34 #endif
35
32 class Pickle; 36 class Pickle;
33 37
34 namespace WebKit { 38 namespace WebKit {
35 class WebImage; 39 class WebImage;
36 struct WebCursorInfo; 40 struct WebCursorInfo;
37 } 41 }
38 42
39 // This class encapsulates a cross-platform description of a cursor. Platform 43 // This class encapsulates a cross-platform description of a cursor. Platform
40 // specific methods are provided to translate the cross-platform cursor into a 44 // specific methods are provided to translate the cross-platform cursor into a
41 // platform specific cursor. It is also possible to serialize / de-serialize a 45 // platform specific cursor. It is also possible to serialize / de-serialize a
(...skipping 21 matching lines...) Expand all
63 bool IsCustom() const; 67 bool IsCustom() const;
64 68
65 // Returns true if the current cursor object contains the same cursor as the 69 // Returns true if the current cursor object contains the same cursor as the
66 // cursor object passed in. If the current cursor is a custom cursor, we also 70 // cursor object passed in. If the current cursor is a custom cursor, we also
67 // compare the bitmaps to verify whether they are equal. 71 // compare the bitmaps to verify whether they are equal.
68 bool IsEqual(const WebCursor& other) const; 72 bool IsEqual(const WebCursor& other) const;
69 73
70 // Returns a native cursor representing the current WebCursor instance. 74 // Returns a native cursor representing the current WebCursor instance.
71 gfx::NativeCursor GetNativeCursor(); 75 gfx::NativeCursor GetNativeCursor();
72 76
73 #if defined(OS_WIN) && !defined(USE_AURA) 77 #if defined(USE_AURA)
78 const gfx::PlatformCursor& GetPlatformCursor();
79 #elif defined(OS_WIN)
74 // Returns a HCURSOR representing the current WebCursor instance. 80 // Returns a HCURSOR representing the current WebCursor instance.
75 // The ownership of the HCURSOR (does not apply to external cursors) remains 81 // The ownership of the HCURSOR (does not apply to external cursors) remains
76 // with the WebCursor instance. 82 // with the WebCursor instance.
77 HCURSOR GetCursor(HINSTANCE module_handle); 83 HCURSOR GetCursor(HINSTANCE module_handle);
78 84
79 // Initialize this from the given Windows cursor. The caller must ensure that 85 // Initialize this from the given Windows cursor. The caller must ensure that
80 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon 86 // the HCURSOR remains valid by not invoking the DestroyCursor/DestroyIcon
81 // APIs on it. 87 // APIs on it.
82 void InitFromExternalCursor(HCURSOR handle); 88 void InitFromExternalCursor(HCURSOR handle);
83 89
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // WebCore::PlatformCursor type. 141 // WebCore::PlatformCursor type.
136 int type_; 142 int type_;
137 143
138 gfx::Point hotspot_; 144 gfx::Point hotspot_;
139 145
140 // Custom cursor data, as 32-bit RGBA. 146 // Custom cursor data, as 32-bit RGBA.
141 // Platform-inspecific because it can be serialized. 147 // Platform-inspecific because it can be serialized.
142 gfx::Size custom_size_; 148 gfx::Size custom_size_;
143 std::vector<char> custom_data_; 149 std::vector<char> custom_data_;
144 150
145 #if defined(OS_WIN) 151 #if defined(USE_AURA) && defined(USE_X11)
152 // Only used for custom cursors.
153 gfx::PlatformCursor platform_cursor_;
154 XcursorImage* image_;
155 #elif defined(OS_WIN)
146 // An externally generated HCURSOR. We assume that it remains valid, i.e we 156 // An externally generated HCURSOR. We assume that it remains valid, i.e we
147 // don't attempt to copy the HCURSOR. 157 // don't attempt to copy the HCURSOR.
148 HCURSOR external_cursor_; 158 HCURSOR external_cursor_;
149 // A custom cursor created from custom bitmap data by Webkit. 159 // A custom cursor created from custom bitmap data by Webkit.
150 HCURSOR custom_cursor_; 160 HCURSOR custom_cursor_;
151 #elif defined(TOOLKIT_USES_GTK) 161 #elif defined(TOOLKIT_USES_GTK)
152 // A custom cursor created that should be unref'ed from the destructor. 162 // A custom cursor created that should be unref'ed from the destructor.
153 GdkCursor* unref_; 163 GdkCursor* unref_;
154 #endif 164 #endif
155 }; 165 };
156 166
157 #endif // WEBKIT_GLUE_WEBCURSOR_H_ 167 #endif // WEBKIT_GLUE_WEBCURSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698