Chromium Code Reviews| Index: components/exo/pointer.h |
| diff --git a/components/exo/pointer.h b/components/exo/pointer.h |
| index 67a12efedb18f4ae457f3afc74bcf01d3dc7bf49..46864ee708d47a26dce1de8612ece53c2cea305b 100644 |
| --- a/components/exo/pointer.h |
| +++ b/components/exo/pointer.h |
| @@ -14,6 +14,7 @@ |
| #include "components/exo/surface_observer.h" |
| #include "components/exo/wm_helper.h" |
| #include "ui/base/cursor/cursor.h" |
| +#include "ui/display/display.h" |
| #include "ui/events/event_handler.h" |
| #include "ui/gfx/geometry/point.h" |
| #include "ui/gfx/geometry/point_f.h" |
| @@ -58,6 +59,7 @@ class Pointer : public ui::EventHandler, |
| // Overridden from WMHelper::CursorObserver: |
| void OnCursorSetChanged(ui::CursorSetType cursor_set) override; |
| + void OnCursorDisplayChanging(const display::Display& display) override; |
| // Overridden from SurfaceDelegate: |
| void OnSurfaceCommit() override; |
| @@ -70,18 +72,16 @@ class Pointer : public ui::EventHandler, |
| // Returns the effective target for |event|. |
| Surface* GetEffectiveTargetForEvent(ui::Event* event) const; |
| - // Recompute cursor scale and update cursor if scale changed. |
| - void UpdateCursorScale(); |
| - |
| // Asynchronously update the cursor by capturing a snapshot of |surface_|. |
| - void CaptureCursor(); |
| + void CaptureCursor(bool force); |
|
reveman
2017/03/30 07:47:53
why do we need |force|? can the behavior with forc
Dominik Laskowski
2017/04/05 17:59:25
No, it should only be used to bypass cursor lockin
|
| // Called when cursor snapshot has been captured. |
| - void OnCursorCaptured(const gfx::Point& hotspot, |
|
reveman
2017/03/30 07:47:53
why not const?
Dominik Laskowski
2017/04/05 17:59:25
Belongs to the dependent CL. Moved.
|
| + void OnCursorCaptured(gfx::Point hotspot, |
| + bool force, |
| std::unique_ptr<cc::CopyOutputResult> result); |
| - // Update cursor to reflect the current value of |cursor_|. |
| - void UpdateCursor(); |
| + // If |force| is true, the cursor is updated even if locked. |
| + void UpdateCursor(gfx::NativeCursor cursor, bool force); |
| // The delegate instance that all events are dispatched to. |
| PointerDelegate* const delegate_; |
| @@ -95,17 +95,21 @@ class Pointer : public ui::EventHandler, |
| // The location of the pointer in the current focus surface. |
| gfx::PointF location_; |
| - // The scale applied to the cursor to compensate for the UI scale. |
| + // The display-dependent scale applied to the cursor. |
| + float display_scale_ = 1.0f; |
| + |
| + // The display-independent scale applied to the cursor. |
| float cursor_scale_ = 1.0f; |
| + float device_scale_factor_ = 1.0f; |
|
reveman
2017/03/30 07:47:53
Please add a comment here for consistency.
Dominik Laskowski
2017/04/05 17:59:25
Done.
|
| + |
| // The position of the pointer surface relative to the pointer location. |
| gfx::Point hotspot_; |
| - // The current cursor. |
| - ui::Cursor cursor_; |
| + const std::unique_ptr<aura::Window> cursor_; |
|
reveman
2017/03/30 07:47:53
why do we have to change this? We should avoid usi
Dominik Laskowski
2017/04/05 17:59:25
The snapshot is requested on this layer, because t
|
| // Source used for cursor capture copy output requests. |
| - const base::UnguessableToken cursor_capture_source_id_; |
| + base::UnguessableToken cursor_capture_source_id_; |
| // Weak pointer factory used for cursor capture callbacks. |
| base::WeakPtrFactory<Pointer> cursor_capture_weak_ptr_factory_; |