Chromium Code Reviews| Index: components/exo/pointer.h |
| diff --git a/components/exo/pointer.h b/components/exo/pointer.h |
| index 07cf6bdc0260b9a017054d5eb2d746469b135f2e..59a3560778ff0e2098daaeda62aaf7dc076c65fd 100644 |
| --- a/components/exo/pointer.h |
| +++ b/components/exo/pointer.h |
| @@ -13,7 +13,9 @@ |
| #include "components/exo/surface_delegate.h" |
| #include "components/exo/surface_observer.h" |
| #include "components/exo/wm_helper.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| #include "ui/base/cursor/cursor.h" |
| +#include "ui/display/display.h" |
| #include "ui/events/event_constants.h" |
| #include "ui/events/event_handler.h" |
| #include "ui/gfx/geometry/point.h" |
| @@ -59,6 +61,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; |
| @@ -71,19 +74,18 @@ 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(const gfx::Point& hotspot); |
|
reveman
2017/05/25 10:52:55
why do we need to pass hotspot as an argument to t
Dominik Laskowski
2017/05/31 02:06:27
As discussed offline, the bitmap and hotspot are u
|
| // Called when cursor snapshot has been captured. |
| void OnCursorCaptured(const gfx::Point& hotspot, |
| std::unique_ptr<cc::CopyOutputResult> result); |
| - // Update cursor to reflect the current value of |cursor_|. |
| + // Synchronously update the cursor to the latest snapshot. |
| void UpdateCursor(); |
| + void SetCursor(gfx::NativeCursor cursor); |
|
reveman
2017/05/25 10:52:55
Please a comment for this function and I think we
Dominik Laskowski
2017/05/31 02:06:27
Done.
|
| + |
| // The delegate instance that all events are dispatched to. |
| PointerDelegate* const delegate_; |
| @@ -96,14 +98,20 @@ 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-independent scale applied to the cursor. |
| float cursor_scale_ = 1.0f; |
|
reveman
2017/05/25 10:52:55
Please keep this the scale of |cursor_| as before.
Dominik Laskowski
2017/05/31 02:06:26
Removed per offline chat.
|
| + // Device scale factor of the display where the cursor sprite is located. |
| + float cursor_device_scale_factor_ = 1.0f; |
|
reveman
2017/05/25 10:52:55
Actually, I don't think we need this as all it sho
Dominik Laskowski
2017/05/31 02:06:27
Removed per offline chat.
|
| + |
| + // Rotation of the display where the cursor sprite is located. |
| + display::Display::Rotation cursor_rotation_ = display::Display::ROTATE_0; |
| + |
| // The position of the pointer surface relative to the pointer location. |
| gfx::Point hotspot_; |
| - // The current cursor. |
| - ui::Cursor cursor_; |
|
reveman
2017/05/25 10:52:55
Please keep cursor in addition to bitmap as it's h
Dominik Laskowski
2017/05/31 02:06:27
Done.
|
| + // Latest cursor snapshot. |
| + SkBitmap cursor_bitmap_; |
| // Source used for cursor capture copy output requests. |
| const base::UnguessableToken cursor_capture_source_id_; |