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

Side by Side Diff: ui/base/cursor/cursor_loader_x11.cc

Issue 10967062: linux-aura: Fix setting the default X cursors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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/desktop/desktop_cursor_client.cc ('k') | no next file » | 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/base/cursor/cursor_loader_x11.h" 5 #include "ui/base/cursor/cursor_loader_x11.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 case ui::kCursorSouthWestPanning: 37 case ui::kCursorSouthWestPanning:
38 return XC_bottom_left_corner; 38 return XC_bottom_left_corner;
39 case ui::kCursorWestPanning: 39 case ui::kCursorWestPanning:
40 return XC_sb_left_arrow; 40 return XC_sb_left_arrow;
41 case ui::kCursorNone: 41 case ui::kCursorNone:
42 case ui::kCursorGrab: 42 case ui::kCursorGrab:
43 case ui::kCursorGrabbing: 43 case ui::kCursorGrabbing:
44 // TODO(jamescook): Need cursors for these. crbug.com/111650 44 // TODO(jamescook): Need cursors for these. crbug.com/111650
45 return XC_left_ptr; 45 return XC_left_ptr;
46 46
47 #if defined(OS_CHROMEOS)
47 case ui::kCursorNull: 48 case ui::kCursorNull:
48 case ui::kCursorPointer: 49 case ui::kCursorPointer:
49 case ui::kCursorNoDrop: 50 case ui::kCursorNoDrop:
50 case ui::kCursorNotAllowed: 51 case ui::kCursorNotAllowed:
51 case ui::kCursorCopy: 52 case ui::kCursorCopy:
52 case ui::kCursorMove: 53 case ui::kCursorMove:
53 case ui::kCursorEastResize: 54 case ui::kCursorEastResize:
54 case ui::kCursorNorthResize: 55 case ui::kCursorNorthResize:
55 case ui::kCursorSouthResize: 56 case ui::kCursorSouthResize:
56 case ui::kCursorWestResize: 57 case ui::kCursorWestResize:
(...skipping 11 matching lines...) Expand all
68 case ui::kCursorNorthSouthResize: 69 case ui::kCursorNorthSouthResize:
69 case ui::kCursorEastWestResize: 70 case ui::kCursorEastWestResize:
70 case ui::kCursorNorthEastSouthWestResize: 71 case ui::kCursorNorthEastSouthWestResize:
71 case ui::kCursorNorthWestSouthEastResize: 72 case ui::kCursorNorthWestSouthEastResize:
72 case ui::kCursorProgress: 73 case ui::kCursorProgress:
73 case ui::kCursorColumnResize: 74 case ui::kCursorColumnResize:
74 case ui::kCursorRowResize: 75 case ui::kCursorRowResize:
75 case ui::kCursorVerticalText: 76 case ui::kCursorVerticalText:
76 case ui::kCursorZoomIn: 77 case ui::kCursorZoomIn:
77 case ui::kCursorZoomOut: 78 case ui::kCursorZoomOut:
78 NOTREACHED() << "Cursor (" << native_cursor.native_type() << ") should " 79 // In some environments, the image assets are not set (e.g. in
79 << "have an image asset."; 80 // content-browsertests, content-shell etc.).
80 return XC_left_ptr; 81 return XC_left_ptr;
82 #else // defined(OS_CHROMEOS)
83 case ui::kCursorNull:
84 return XC_left_ptr;
85 case ui::kCursorPointer:
86 return XC_left_ptr;
87 case ui::kCursorCross:
88 return XC_crosshair;
89 case ui::kCursorHand:
90 return XC_hand2;
91 case ui::kCursorIBeam:
92 return XC_xterm;
93 case ui::kCursorWait:
94 return XC_watch;
95 case ui::kCursorHelp:
96 return XC_question_arrow;
97 case ui::kCursorEastResize:
98 return XC_right_side;
99 case ui::kCursorNorthResize:
100 return XC_top_side;
101 case ui::kCursorNorthEastResize:
102 return XC_top_right_corner;
103 case ui::kCursorNorthWestResize:
104 return XC_top_left_corner;
105 case ui::kCursorSouthResize:
106 return XC_bottom_side;
107 case ui::kCursorSouthEastResize:
108 return XC_bottom_right_corner;
109 case ui::kCursorSouthWestResize:
110 return XC_bottom_left_corner;
111 case ui::kCursorWestResize:
112 return XC_left_side;
113 case ui::kCursorNorthSouthResize:
114 return XC_sb_v_double_arrow;
115 case ui::kCursorEastWestResize:
116 return XC_sb_h_double_arrow;
117 case ui::kCursorNorthEastSouthWestResize:
118 case ui::kCursorNorthWestSouthEastResize:
119 // There isn't really a useful cursor available for these.
120 return XC_left_ptr;
121 case ui::kCursorColumnResize:
122 return XC_sb_h_double_arrow;
123 case ui::kCursorRowResize:
124 return XC_sb_v_double_arrow;
125 #endif // defined(OS_CHROMEOS)
81 case ui::kCursorCustom: 126 case ui::kCursorCustom:
82 NOTREACHED(); 127 NOTREACHED();
83 return XC_left_ptr; 128 return XC_left_ptr;
84 } 129 }
85 NOTREACHED(); 130 NOTREACHED();
86 return XC_left_ptr; 131 return XC_left_ptr;
87 } 132 }
88 133
89 } // namespace 134 } // namespace
90 135
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) { 234 bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) {
190 int type = native_cursor.native_type(); 235 int type = native_cursor.native_type();
191 return cursors_.count(type) || animated_cursors_.count(type); 236 return cursors_.count(type) || animated_cursors_.count(type);
192 } 237 }
193 238
194 ::Cursor CursorLoaderX11::ImageCursorFromNative( 239 ::Cursor CursorLoaderX11::ImageCursorFromNative(
195 gfx::NativeCursor native_cursor) { 240 gfx::NativeCursor native_cursor) {
196 int type = native_cursor.native_type(); 241 int type = native_cursor.native_type();
197 if (animated_cursors_.count(type)) 242 if (animated_cursors_.count(type))
198 return animated_cursors_[type].first; 243 return animated_cursors_[type].first;
199 DCHECK(cursors_.find(type) != cursors_.end()); 244
200 return cursors_[type]; 245 ImageCursorMap::iterator find = cursors_.find(type);
246 if (find != cursors_.end())
247 return cursors_[type];
248 return ui::GetXCursor(CursorShapeFromNative(native_cursor));
201 } 249 }
202 250
203 } 251 }
OLDNEW
« no previous file with comments | « ui/aura/desktop/desktop_cursor_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698