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