Index: components/exo/pointer.h |
diff --git a/components/exo/pointer.h b/components/exo/pointer.h |
index 07cf6bdc0260b9a017054d5eb2d746469b135f2e..2781eca1a297527fce462c895aed63e5b4223834 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,17 @@ 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(); |
reveman
2017/05/23 17:06:58
Can we keep this and instead add a UpdateCursorDev
Dominik Laskowski
2017/05/24 00:43:04
Checking for scale/rotation changes for each mouse
reveman
2017/05/25 10:52:55
Yes, let's rename this to UpdateCursor() and call
Dominik Laskowski
2017/05/31 02:06:26
Done.
|
- |
// Asynchronously update the cursor by capturing a snapshot of |surface_|. |
void CaptureCursor(); |
// Called when cursor snapshot has been captured. |
- void OnCursorCaptured(const gfx::Point& hotspot, |
reveman
2017/05/23 17:06:57
I think we need to have hotspot updates flow throu
Dominik Laskowski
2017/05/24 00:43:04
Good point. I've updated SetCursor to save the hot
|
- std::unique_ptr<cc::CopyOutputResult> result); |
+ void OnCursorCaptured(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); |
+ |
// The delegate instance that all events are dispatched to. |
PointerDelegate* const delegate_; |
@@ -96,14 +97,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; |
+ // Device scale factor of the display where the mouse is located. |
+ float device_scale_factor_ = 1.0f; |
reveman
2017/05/23 17:06:58
nit: s/device_scale_factor_/cursor_device_scale_fa
Dominik Laskowski
2017/05/24 00:43:04
Done.
|
+ |
+ // Rotation of the display where the mouse is located. |
+ display::Display::Rotation rotation_ = display::Display::ROTATE_0; |
reveman
2017/05/23 17:06:58
nit: s/rotation_/cursor_rotation_/ and s/mouse/cur
Dominik Laskowski
2017/05/24 00:43:04
Done.
|
+ |
// The position of the pointer surface relative to the pointer location. |
gfx::Point hotspot_; |
- // The current cursor. |
- ui::Cursor cursor_; |
+ // Latest cursor snapshot. |
+ SkBitmap cursor_; |
reveman
2017/05/23 17:06:58
Please keep this as before and add another member
Dominik Laskowski
2017/05/24 00:43:04
Renamed, but the ui::Cursor is redundant, i.e. Cur
|
// Source used for cursor capture copy output requests. |
const base::UnguessableToken cursor_capture_source_id_; |