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

Side by Side Diff: components/exo/pointer.h

Issue 2071553002: Initial support of large mouse cursor on Exosphere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dependency to wm::test_support from ash::unittests Created 4 years, 5 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
« no previous file with comments | « ash/wm/window_manager_unittest.cc ('k') | components/exo/pointer.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_EXO_POINTER_H_ 5 #ifndef COMPONENTS_EXO_POINTER_H_
6 #define COMPONENTS_EXO_POINTER_H_ 6 #define COMPONENTS_EXO_POINTER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/exo/surface_delegate.h" 11 #include "components/exo/surface_delegate.h"
12 #include "components/exo/surface_observer.h" 12 #include "components/exo/surface_observer.h"
13 #include "ui/aura/client/cursor_client_observer.h"
13 #include "ui/events/event_handler.h" 14 #include "ui/events/event_handler.h"
14 #include "ui/gfx/geometry/point.h" 15 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/point_f.h" 16 #include "ui/gfx/geometry/point_f.h"
16 17
17 namespace ui { 18 namespace ui {
18 class Event; 19 class Event;
19 class MouseEvent; 20 class MouseEvent;
20 class MouseWheelEvent; 21 class MouseWheelEvent;
21 } 22 }
22 23
23 namespace views { 24 namespace views {
24 class Widget; 25 class Widget;
25 } 26 }
26 27
27 namespace exo { 28 namespace exo {
28 class PointerDelegate; 29 class PointerDelegate;
29 class Surface; 30 class Surface;
30 31
31 // This class implements a client pointer that represents one or more input 32 // This class implements a client pointer that represents one or more input
32 // devices, such as mice, which control the pointer location and pointer focus. 33 // devices, such as mice, which control the pointer location and pointer focus.
33 class Pointer : public ui::EventHandler, 34 class Pointer : public ui::EventHandler,
35 public aura::client::CursorClientObserver,
34 public SurfaceDelegate, 36 public SurfaceDelegate,
35 public SurfaceObserver { 37 public SurfaceObserver {
36 public: 38 public:
37 explicit Pointer(PointerDelegate* delegate); 39 explicit Pointer(PointerDelegate* delegate);
38 ~Pointer() override; 40 ~Pointer() override;
39 41
40 // Set the pointer surface, i.e., the surface that contains the pointer image 42 // Set the pointer surface, i.e., the surface that contains the pointer image
41 // (cursor). The |hotspot| argument defines the position of the pointer 43 // (cursor). The |hotspot| argument defines the position of the pointer
42 // surface relative to the pointer location. Its top-left corner is always at 44 // surface relative to the pointer location. Its top-left corner is always at
43 // (x, y) - (hotspot.x, hotspot.y), where (x, y) are the coordinates of the 45 // (x, y) - (hotspot.x, hotspot.y), where (x, y) are the coordinates of the
44 // pointer location, in surface local coordinates. 46 // pointer location, in surface local coordinates.
45 void SetCursor(Surface* surface, const gfx::Point& hotspot); 47 void SetCursor(Surface* surface, const gfx::Point& hotspot);
46 48
47 // Overridden from ui::EventHandler: 49 // Overridden from ui::EventHandler:
48 void OnMouseEvent(ui::MouseEvent* event) override; 50 void OnMouseEvent(ui::MouseEvent* event) override;
49 void OnScrollEvent(ui::ScrollEvent* event) override; 51 void OnScrollEvent(ui::ScrollEvent* event) override;
50 52
53 // Overridden from aura::client::CursorClientObserver:
54 void OnCursorSetChanged(ui::CursorSetType cursor_set) override;
55
51 // Overridden from SurfaceDelegate: 56 // Overridden from SurfaceDelegate:
52 void OnSurfaceCommit() override; 57 void OnSurfaceCommit() override;
53 bool IsSurfaceSynchronized() const override; 58 bool IsSurfaceSynchronized() const override;
54 59
55 // Overridden from SurfaceObserver: 60 // Overridden from SurfaceObserver:
56 void OnSurfaceDestroying(Surface* surface) override; 61 void OnSurfaceDestroying(Surface* surface) override;
57 62
58 private: 63 private:
59 // Creates the |widget_| for pointer. 64 // Creates the |widget_| for pointer.
60 void CreatePointerWidget(); 65 void CreatePointerWidget();
61 66
67 // Updates the scale of the cursor with the latest state.
68 void UpdateCursorScale();
69
62 // Returns the effective target for |event|. 70 // Returns the effective target for |event|.
63 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; 71 Surface* GetEffectiveTargetForEvent(ui::Event* event) const;
64 72
65 // The delegate instance that all events are dispatched to. 73 // The delegate instance that all events are dispatched to.
66 PointerDelegate* const delegate_; 74 PointerDelegate* const delegate_;
67 75
68 // The widget for the pointer cursor. 76 // The widget for the pointer cursor.
69 std::unique_ptr<views::Widget> widget_; 77 std::unique_ptr<views::Widget> widget_;
70 78
71 // The current pointer surface. 79 // The current pointer surface.
(...skipping 10 matching lines...) Expand all
82 90
83 // The position of the pointer surface relative to the pointer location. 91 // The position of the pointer surface relative to the pointer location.
84 gfx::Point hotspot_; 92 gfx::Point hotspot_;
85 93
86 DISALLOW_COPY_AND_ASSIGN(Pointer); 94 DISALLOW_COPY_AND_ASSIGN(Pointer);
87 }; 95 };
88 96
89 } // namespace exo 97 } // namespace exo
90 98
91 #endif // COMPONENTS_EXO_POINTER_H_ 99 #endif // COMPONENTS_EXO_POINTER_H_
OLDNEW
« no previous file with comments | « ash/wm/window_manager_unittest.cc ('k') | components/exo/pointer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698