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

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

Issue 134823003: Define Panning cursors only on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/base/cursor/cursor.h ('k') | ui/resources/ui_resources.grd » ('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/base/cursor/cursor_loader_x11.h" 5 #include "ui/base/cursor/cursor_loader_x11.h"
6 6
7 #include <float.h> 7 #include <float.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/cursorfont.h> 9 #include <X11/cursorfont.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "grit/ui_resources.h" 12 #include "grit/ui_resources.h"
13 #include "skia/ext/image_operations.h" 13 #include "skia/ext/image_operations.h"
14 #include "ui/base/cursor/cursor.h" 14 #include "ui/base/cursor/cursor.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/base/x/x11_util.h" 16 #include "ui/base/x/x11_util.h"
17 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
18 #include "ui/gfx/image/image_skia.h" 18 #include "ui/gfx/image/image_skia.h"
19 #include "ui/gfx/point_conversions.h" 19 #include "ui/gfx/point_conversions.h"
20 #include "ui/gfx/size_conversions.h" 20 #include "ui/gfx/size_conversions.h"
21 #include "ui/gfx/skbitmap_operations.h" 21 #include "ui/gfx/skbitmap_operations.h"
22 #include "ui/gfx/skia_util.h" 22 #include "ui/gfx/skia_util.h"
23 23
24 namespace { 24 namespace {
25 25
26 // Returns X font cursor shape from an Aura cursor. 26 // Returns X font cursor shape from an Aura cursor.
27 int CursorShapeFromNative(const gfx::NativeCursor& native_cursor) { 27 int CursorShapeFromNative(const gfx::NativeCursor& native_cursor) {
28 switch (native_cursor.native_type()) { 28 switch (native_cursor.native_type()) {
29 case ui::kCursorMiddlePanning:
30 return XC_fleur;
31 case ui::kCursorEastPanning:
32 return XC_sb_right_arrow;
33 case ui::kCursorNorthPanning:
34 return XC_sb_up_arrow;
35 case ui::kCursorNorthEastPanning:
36 return XC_top_right_corner;
37 case ui::kCursorNorthWestPanning:
38 return XC_top_left_corner;
39 case ui::kCursorSouthPanning:
40 return XC_sb_down_arrow;
41 case ui::kCursorSouthEastPanning:
42 return XC_bottom_right_corner;
43 case ui::kCursorSouthWestPanning:
44 return XC_bottom_left_corner;
45 case ui::kCursorWestPanning:
46 return XC_sb_left_arrow;
47 case ui::kCursorNone: 29 case ui::kCursorNone:
48 case ui::kCursorGrab: 30 case ui::kCursorGrab:
49 case ui::kCursorGrabbing: 31 case ui::kCursorGrabbing:
50 // TODO(jamescook): Need cursors for these. crbug.com/111650 32 // TODO(jamescook): Need cursors for these. crbug.com/111650
51 return XC_left_ptr; 33 return XC_left_ptr;
52 34
53 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
54 case ui::kCursorNull: 36 case ui::kCursorNull:
55 case ui::kCursorPointer: 37 case ui::kCursorPointer:
56 case ui::kCursorNoDrop: 38 case ui::kCursorNoDrop:
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 279
298 *bitmap = skia::ImageOperations::Resize( 280 *bitmap = skia::ImageOperations::Resize(
299 *bitmap, 281 *bitmap,
300 skia::ImageOperations::RESIZE_BETTER, 282 skia::ImageOperations::RESIZE_BETTER,
301 scaled_size.width(), 283 scaled_size.width(),
302 scaled_size.height()); 284 scaled_size.height());
303 *hotpoint = gfx::ToFlooredPoint(gfx::ScalePoint(*hotpoint, scale)); 285 *hotpoint = gfx::ToFlooredPoint(gfx::ScalePoint(*hotpoint, scale));
304 } 286 }
305 287
306 } // namespace ui 288 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/cursor/cursor.h ('k') | ui/resources/ui_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698