Loading services/inputflinger/PointerChoreographer.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -316,14 +316,13 @@ void PointerChoreographer::processPointerDeviceMotionEventLocked(NotifyMotionArg void PointerChoreographer::handleUnconsumedDeltaLocked(PointerControllerInterface& pc, const vec2& unconsumedDelta) { // Display topology is in rotated coordinate space and Pointer controller returns and expects // Display topology is in rotated coordinate space and PointerController expects // values in the un-rotated coordinate space. So we need to transform delta and cursor position // back to the rotated coordinate space to lookup adjacent display in the display topology. const auto& sourceDisplayTransform = pc.getDisplayTransform(); const vec2 rotatedUnconsumedDelta = transformWithoutTranslation(sourceDisplayTransform, unconsumedDelta); const vec2 cursorPosition = pc.getPosition(); const vec2 rotatedCursorPosition = sourceDisplayTransform.transform(cursorPosition); const vec2 rotatedCursorPosition = pc.getPositionInLogicalDisplay(); // To find out the boundary that cursor is crossing we are checking delta in x and y direction // respectively. This prioritizes x direction over y. Loading Loading @@ -1070,10 +1069,10 @@ vec2 PointerChoreographer::filterPointerMotionForAccessibilityLocked( return delta; } // PointerController.getPosition and mouse delta are both in physical display coordinates. // PointerController expects coordinates in physical display coordinates. // PointerMotionFilter in Java expects coordinates in logical display coordinates. const auto& displayTransform = pc.getDisplayTransform(); const vec2 current = displayTransform.transform(pc.getPosition()); const vec2 current = pc.getPositionInLogicalDisplay(); const vec2 deltaInDisplay = transformWithoutTranslation(displayTransform, delta); const ui::LogicalDisplayId displayId = pc.getDisplayId(); const std::optional<vec2> filterResult = Loading services/inputflinger/include/PointerControllerInterface.h +6 −2 Original line number Diff line number Diff line Loading @@ -60,17 +60,21 @@ public: /* Move the pointer and return unconsumed delta if the pointer has crossed the current * viewport bounds. * The movement should be in the display physical coordinates. * * Return value may be used to move pointer to corresponding adjacent display, if it exists in * the display-topology */ [[nodiscard]] virtual vec2 move(float deltaX, float deltaY) = 0; /* Sets the absolute location of the pointer. */ /* Sets the display physical location of the pointer. */ virtual void setPosition(float x, float y) = 0; /* Gets the absolute location of the pointer. */ /* Gets the display physical location of the pointer. */ virtual vec2 getPosition() const = 0; /* Gets the display logical location of the pointer. */ virtual vec2 getPositionInLogicalDisplay() const = 0; enum class Transition { // Fade/unfade immediately. IMMEDIATE, Loading services/inputflinger/tests/FakePointerController.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,14 @@ vec2 FakePointerController::getPosition() const { return {mX, mY}; } vec2 FakePointerController::getPositionInLogicalDisplay() const { if (!mEnabled) { return {0, 0}; } return mTransform.transform(mX, mY); } ui::LogicalDisplayId FakePointerController::getDisplayId() const { if (!mEnabled || !mDisplayId) { return ui::LogicalDisplayId::INVALID; Loading services/inputflinger/tests/FakePointerController.h +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public: void setPosition(float x, float y) override; vec2 getPosition() const override; vec2 getPositionInLogicalDisplay() const override; ui::LogicalDisplayId getDisplayId() const override; void setDisplayViewport(const DisplayViewport& viewport) override; void updatePointerIcon(PointerIconStyle iconId) override; Loading Loading
services/inputflinger/PointerChoreographer.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -316,14 +316,13 @@ void PointerChoreographer::processPointerDeviceMotionEventLocked(NotifyMotionArg void PointerChoreographer::handleUnconsumedDeltaLocked(PointerControllerInterface& pc, const vec2& unconsumedDelta) { // Display topology is in rotated coordinate space and Pointer controller returns and expects // Display topology is in rotated coordinate space and PointerController expects // values in the un-rotated coordinate space. So we need to transform delta and cursor position // back to the rotated coordinate space to lookup adjacent display in the display topology. const auto& sourceDisplayTransform = pc.getDisplayTransform(); const vec2 rotatedUnconsumedDelta = transformWithoutTranslation(sourceDisplayTransform, unconsumedDelta); const vec2 cursorPosition = pc.getPosition(); const vec2 rotatedCursorPosition = sourceDisplayTransform.transform(cursorPosition); const vec2 rotatedCursorPosition = pc.getPositionInLogicalDisplay(); // To find out the boundary that cursor is crossing we are checking delta in x and y direction // respectively. This prioritizes x direction over y. Loading Loading @@ -1070,10 +1069,10 @@ vec2 PointerChoreographer::filterPointerMotionForAccessibilityLocked( return delta; } // PointerController.getPosition and mouse delta are both in physical display coordinates. // PointerController expects coordinates in physical display coordinates. // PointerMotionFilter in Java expects coordinates in logical display coordinates. const auto& displayTransform = pc.getDisplayTransform(); const vec2 current = displayTransform.transform(pc.getPosition()); const vec2 current = pc.getPositionInLogicalDisplay(); const vec2 deltaInDisplay = transformWithoutTranslation(displayTransform, delta); const ui::LogicalDisplayId displayId = pc.getDisplayId(); const std::optional<vec2> filterResult = Loading
services/inputflinger/include/PointerControllerInterface.h +6 −2 Original line number Diff line number Diff line Loading @@ -60,17 +60,21 @@ public: /* Move the pointer and return unconsumed delta if the pointer has crossed the current * viewport bounds. * The movement should be in the display physical coordinates. * * Return value may be used to move pointer to corresponding adjacent display, if it exists in * the display-topology */ [[nodiscard]] virtual vec2 move(float deltaX, float deltaY) = 0; /* Sets the absolute location of the pointer. */ /* Sets the display physical location of the pointer. */ virtual void setPosition(float x, float y) = 0; /* Gets the absolute location of the pointer. */ /* Gets the display physical location of the pointer. */ virtual vec2 getPosition() const = 0; /* Gets the display logical location of the pointer. */ virtual vec2 getPositionInLogicalDisplay() const = 0; enum class Transition { // Fade/unfade immediately. IMMEDIATE, Loading
services/inputflinger/tests/FakePointerController.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,14 @@ vec2 FakePointerController::getPosition() const { return {mX, mY}; } vec2 FakePointerController::getPositionInLogicalDisplay() const { if (!mEnabled) { return {0, 0}; } return mTransform.transform(mX, mY); } ui::LogicalDisplayId FakePointerController::getDisplayId() const { if (!mEnabled || !mDisplayId) { return ui::LogicalDisplayId::INVALID; Loading
services/inputflinger/tests/FakePointerController.h +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public: void setPosition(float x, float y) override; vec2 getPosition() const override; vec2 getPositionInLogicalDisplay() const override; ui::LogicalDisplayId getDisplayId() const override; void setDisplayViewport(const DisplayViewport& viewport) override; void updatePointerIcon(PointerIconStyle iconId) override; Loading