Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ui/aura/root_window_host_win.cc

Issue 9463003: aura-x11: Add custom web cursor support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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
« no previous file with comments | « ui/aura/root_window_host_linux.cc ('k') | ui/base/cursor/cursor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/aura/root_window_host_win.h" 5 #include "ui/aura/root_window_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ui/aura/root_window.h"
13 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
14 #include "ui/aura/event.h" 13 #include "ui/aura/event.h"
14 #include "ui/aura/root_window.h"
15 15
16 using std::max; 16 using std::max;
17 using std::min; 17 using std::min;
18 18
19 namespace aura { 19 namespace aura {
20 20
21 namespace { 21 namespace {
22 22
23 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { 23 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
24 switch (native_cursor) { 24 switch (native_cursor.native_type()) {
25 case kCursorNull: 25 case ui::kCursorNull:
26 return IDC_ARROW; 26 return IDC_ARROW;
27 case kCursorPointer: 27 case ui::kCursorPointer:
28 return IDC_ARROW; 28 return IDC_ARROW;
29 case kCursorCross: 29 case ui::kCursorCross:
30 return IDC_CROSS; 30 return IDC_CROSS;
31 case kCursorHand: 31 case ui::kCursorHand:
32 return IDC_HAND; 32 return IDC_HAND;
33 case kCursorIBeam: 33 case ui::kCursorIBeam:
34 return IDC_IBEAM; 34 return IDC_IBEAM;
35 case kCursorWait: 35 case ui::kCursorWait:
36 return IDC_WAIT; 36 return IDC_WAIT;
37 case kCursorHelp: 37 case ui::kCursorHelp:
38 return IDC_HELP; 38 return IDC_HELP;
39 case kCursorEastResize: 39 case ui::kCursorEastResize:
40 return IDC_SIZEWE; 40 return IDC_SIZEWE;
41 case kCursorNorthResize: 41 case ui::kCursorNorthResize:
42 return IDC_SIZENS; 42 return IDC_SIZENS;
43 case kCursorNorthEastResize: 43 case ui::kCursorNorthEastResize:
44 return IDC_SIZENESW; 44 return IDC_SIZENESW;
45 case kCursorNorthWestResize: 45 case ui::kCursorNorthWestResize:
46 return IDC_SIZENWSE; 46 return IDC_SIZENWSE;
47 case kCursorSouthResize: 47 case ui::kCursorSouthResize:
48 return IDC_SIZENS; 48 return IDC_SIZENS;
49 case kCursorSouthEastResize: 49 case ui::kCursorSouthEastResize:
50 return IDC_SIZENWSE; 50 return IDC_SIZENWSE;
51 case kCursorSouthWestResize: 51 case ui::kCursorSouthWestResize:
52 return IDC_SIZENESW; 52 return IDC_SIZENESW;
53 case kCursorWestResize: 53 case ui::kCursorWestResize:
54 return IDC_SIZEWE; 54 return IDC_SIZEWE;
55 case kCursorNorthSouthResize: 55 case ui::kCursorNorthSouthResize:
56 return IDC_SIZENS; 56 return IDC_SIZENS;
57 case kCursorEastWestResize: 57 case ui::kCursorEastWestResize:
58 return IDC_SIZEWE; 58 return IDC_SIZEWE;
59 case kCursorNorthEastSouthWestResize: 59 case ui::kCursorNorthEastSouthWestResize:
60 return IDC_SIZENESW; 60 return IDC_SIZENESW;
61 case kCursorNorthWestSouthEastResize: 61 case ui::kCursorNorthWestSouthEastResize:
62 return IDC_SIZENWSE; 62 return IDC_SIZENWSE;
63 case kCursorMove: 63 case ui::kCursorMove:
64 return IDC_SIZEALL; 64 return IDC_SIZEALL;
65 case kCursorProgress: 65 case ui::kCursorProgress:
66 return IDC_APPSTARTING; 66 return IDC_APPSTARTING;
67 case kCursorNoDrop: 67 case ui::kCursorNoDrop:
68 return IDC_NO; 68 return IDC_NO;
69 case kCursorNotAllowed: 69 case ui::kCursorNotAllowed:
70 return IDC_NO; 70 return IDC_NO;
71 case kCursorColumnResize: 71 case ui::kCursorColumnResize:
72 case kCursorRowResize: 72 case ui::kCursorRowResize:
73 case kCursorMiddlePanning: 73 case ui::kCursorMiddlePanning:
74 case kCursorEastPanning: 74 case ui::kCursorEastPanning:
75 case kCursorNorthPanning: 75 case ui::kCursorNorthPanning:
76 case kCursorNorthEastPanning: 76 case ui::kCursorNorthEastPanning:
77 case kCursorNorthWestPanning: 77 case ui::kCursorNorthWestPanning:
78 case kCursorSouthPanning: 78 case ui::kCursorSouthPanning:
79 case kCursorSouthEastPanning: 79 case ui::kCursorSouthEastPanning:
80 case kCursorSouthWestPanning: 80 case ui::kCursorSouthWestPanning:
81 case kCursorWestPanning: 81 case ui::kCursorWestPanning:
82 case kCursorVerticalText: 82 case ui::kCursorVerticalText:
83 case kCursorCell: 83 case ui::kCursorCell:
84 case kCursorContextMenu: 84 case ui::kCursorContextMenu:
85 case kCursorAlias: 85 case ui::kCursorAlias:
86 case kCursorCopy: 86 case ui::kCursorCopy:
87 case kCursorNone: 87 case ui::kCursorNone:
88 case kCursorZoomIn: 88 case ui::kCursorZoomIn:
89 case kCursorZoomOut: 89 case ui::kCursorZoomOut:
90 case kCursorGrab: 90 case ui::kCursorGrab:
91 case kCursorGrabbing: 91 case ui::kCursorGrabbing:
92 case kCursorCustom: 92 case ui::kCursorCustom:
93 // TODO(jamescook): Should we use WebKit glue resources for these? 93 // TODO(jamescook): Should we use WebKit glue resources for these?
94 // Or migrate those resources to someplace ui/aura can share? 94 // Or migrate those resources to someplace ui/aura can share?
95 NOTIMPLEMENTED(); 95 NOTIMPLEMENTED();
96 return IDC_ARROW; 96 return IDC_ARROW;
97 default: 97 default:
98 NOTREACHED(); 98 NOTREACHED();
99 return IDC_ARROW; 99 return IDC_ARROW;
100 } 100 }
101 } 101 }
102 102
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 gfx::Point RootWindowHostWin::GetLocationOnNativeScreen() const { 205 gfx::Point RootWindowHostWin::GetLocationOnNativeScreen() const {
206 RECT r; 206 RECT r;
207 GetClientRect(hwnd(), &r); 207 GetClientRect(hwnd(), &r);
208 return gfx::Point(r.left, r.top); 208 return gfx::Point(r.left, r.top);
209 } 209 }
210 210
211 211
212 void RootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) { 212 void RootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) {
213 // Custom web cursors are handled directly. 213 // Custom web cursors are handled directly.
214 if (native_cursor == kCursorCustom) 214 if (native_cursor == ui::kCursorCustom)
215 return; 215 return;
216 const wchar_t* cursor_id = GetCursorId(native_cursor); 216 const wchar_t* cursor_id = GetCursorId(native_cursor);
217 // TODO(jamescook): Support for non-system cursors will require finding 217 // TODO(jamescook): Support for non-system cursors will require finding
218 // the appropriate module to pass to LoadCursor(). 218 // the appropriate module to pass to LoadCursor().
219 ::SetCursor(LoadCursor(NULL, cursor_id)); 219 ::SetCursor(LoadCursor(NULL, cursor_id));
220 } 220 }
221 221
222 void RootWindowHostWin::SetCapture() { 222 void RootWindowHostWin::SetCapture() {
223 if (!has_capture_) { 223 if (!has_capture_) {
224 has_capture_ = true; 224 has_capture_ = true;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 314 }
315 315
316 void RootWindowHostWin::OnSize(UINT param, const CSize& size) { 316 void RootWindowHostWin::OnSize(UINT param, const CSize& size) {
317 // Minimizing resizes the window to 0x0 which causes our layout to go all 317 // Minimizing resizes the window to 0x0 which causes our layout to go all
318 // screwy, so we just ignore it. 318 // screwy, so we just ignore it.
319 if (param != SIZE_MINIMIZED) 319 if (param != SIZE_MINIMIZED)
320 root_window_->OnHostResized(gfx::Size(size.cx, size.cy)); 320 root_window_->OnHostResized(gfx::Size(size.cx, size.cy));
321 } 321 }
322 322
323 } // namespace aura 323 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_linux.cc ('k') | ui/base/cursor/cursor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698