diff options
author | 2024-10-25 21:08:08 +0000 | |
---|---|---|
committer | 2024-11-18 11:01:03 +0000 | |
commit | 24c8ba68bdfc5a728db06e3a778b2b4f43bca4e7 (patch) | |
tree | 8cf43165ce69e9479dd8b032f7f38363256c7476 /libs/input/PointerController.cpp | |
parent | c319a30b5959af12369518757261476ae27857b9 (diff) |
Check if cursor has moved out of viewport bounds in CursorController
This CL updates CursorController to check if and which boundary the
cursor has crossed. This will be used to enable cursor moving between
different connected displays.
Test: presubmit and manual
Bug: 367660694
Flag: com.android.input.flags.connected_displays_cursor
Change-Id: Ib559e0d72364f446269e73cfa1671ee9d2f715ac
Diffstat (limited to 'libs/input/PointerController.cpp')
-rw-r--r-- | libs/input/PointerController.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp index 78d7d3a7051b..59397dab592f 100644 --- a/libs/input/PointerController.cpp +++ b/libs/input/PointerController.cpp @@ -138,15 +138,18 @@ std::mutex& PointerController::getLock() const { return mDisplayInfoListener->mLock; } -void PointerController::move(float deltaX, float deltaY) { +vec2 PointerController::move(float deltaX, float deltaY) { const ui::LogicalDisplayId displayId = mCursorController.getDisplayId(); - vec2 transformed; + ui::Transform transform; { std::scoped_lock lock(getLock()); - const auto& transform = getTransformForDisplayLocked(displayId); - transformed = transformWithoutTranslation(transform, {deltaX, deltaY}); + transform = getTransformForDisplayLocked(displayId); } - mCursorController.move(transformed.x, transformed.y); + + vec2 transformed = transformWithoutTranslation(transform, {deltaX, deltaY}); + + vec2 unconsumedDelta = mCursorController.move(transformed.x, transformed.y); + return transformWithoutTranslation(transform.inverse(), unconsumedDelta); } void PointerController::setPosition(float x, float y) { |