OLD | NEW |
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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void OnSurfaceDestroying(Surface* surface) override; | 70 void OnSurfaceDestroying(Surface* surface) override; |
71 | 71 |
72 private: | 72 private: |
73 // Returns the effective target for |event|. | 73 // Returns the effective target for |event|. |
74 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; | 74 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; |
75 | 75 |
76 // Asynchronously update the cursor by capturing a snapshot of |surface_|. | 76 // Asynchronously update the cursor by capturing a snapshot of |surface_|. |
77 void CaptureCursor(); | 77 void CaptureCursor(); |
78 | 78 |
79 // Called when cursor snapshot has been captured. | 79 // Called when cursor snapshot has been captured. |
80 void OnCursorCaptured(const gfx::Point& hotspot, | 80 void OnCursorCaptured(gfx::Point hotspot, |
81 std::unique_ptr<cc::CopyOutputResult> result); | 81 std::unique_ptr<cc::CopyOutputResult> result); |
82 | 82 |
83 void UpdateCursor(gfx::NativeCursor cursor); | 83 void UpdateCursor(gfx::NativeCursor cursor); |
84 | 84 |
85 // The delegate instance that all events are dispatched to. | 85 // The delegate instance that all events are dispatched to. |
86 PointerDelegate* const delegate_; | 86 PointerDelegate* const delegate_; |
87 | 87 |
88 // The current pointer surface. | 88 // The current pointer surface. |
89 Surface* surface_ = nullptr; | 89 Surface* surface_ = nullptr; |
90 | 90 |
91 // The current focus surface for the pointer. | 91 // The current focus surface for the pointer. |
92 Surface* focus_ = nullptr; | 92 Surface* focus_ = nullptr; |
93 | 93 |
94 // The location of the pointer in the current focus surface. | 94 // The location of the pointer in the current focus surface. |
95 gfx::PointF location_; | 95 gfx::PointF location_; |
96 | 96 |
97 // The display-dependent scale applied to the cursor. | 97 // The display-dependent scale applied to the cursor. |
98 float display_scale_ = 1.0f; | 98 float display_scale_ = 1.0f; |
99 | 99 |
100 // The display-independent scale applied to the cursor. | 100 // The display-independent scale applied to the cursor. |
101 float cursor_scale_ = 1.0f; | 101 float cursor_scale_ = 1.0f; |
102 | 102 |
103 // Device scale factor of the display where the mouse is located. | 103 // Device scale factor of the display where the mouse is located. |
104 float device_scale_factor_ = 1.0f; | 104 float device_scale_factor_ = 1.0f; |
105 | 105 |
| 106 // Rotation of the display where the mouse is located. |
| 107 display::Display::Rotation rotation_ = display::Display::ROTATE_0; |
| 108 |
106 // The position of the pointer surface relative to the pointer location. | 109 // The position of the pointer surface relative to the pointer location. |
107 gfx::Point hotspot_; | 110 gfx::Point hotspot_; |
108 | 111 |
109 const std::unique_ptr<aura::Window> cursor_; | 112 const std::unique_ptr<aura::Window> cursor_; |
110 | 113 |
111 // Source used for cursor capture copy output requests. | 114 // Source used for cursor capture copy output requests. |
112 const base::UnguessableToken cursor_capture_source_id_; | 115 const base::UnguessableToken cursor_capture_source_id_; |
113 | 116 |
114 // Last received event type. | 117 // Last received event type. |
115 ui::EventType last_event_type_ = ui::ET_UNKNOWN; | 118 ui::EventType last_event_type_ = ui::ET_UNKNOWN; |
116 | 119 |
117 // Weak pointer factory used for cursor capture callbacks. | 120 // Weak pointer factory used for cursor capture callbacks. |
118 base::WeakPtrFactory<Pointer> cursor_capture_weak_ptr_factory_; | 121 base::WeakPtrFactory<Pointer> cursor_capture_weak_ptr_factory_; |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(Pointer); | 123 DISALLOW_COPY_AND_ASSIGN(Pointer); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace exo | 126 } // namespace exo |
124 | 127 |
125 #endif // COMPONENTS_EXO_POINTER_H_ | 128 #endif // COMPONENTS_EXO_POINTER_H_ |
OLD | NEW |