Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 259a2122 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Revert "Change PointerController to display space"

Revert submission 16194643-pointer-controller-in-display-space

Reason for revert: b/206817973
Reverted Changes:
I764c070ad:Change PointerController to display space
I5e9e19c36:Change PointerController to display space

Change-Id: If6e96f41873dd9601f49fc9f9f514a95394f3c58
parent 6b430413
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -201,11 +201,6 @@ namespace android {
class Parcel;
#endif

/*
 * Apply the given transform to the point without applying any translation/offset.
 */
vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy);

const char* inputEventTypeToString(int32_t type);

std::string inputEventSourceToString(int32_t source);
+6 −6
Original line number Diff line number Diff line
@@ -60,6 +60,12 @@ float transformAngle(const ui::Transform& transform, float angleRadians) {
    return atan2f(transformedPoint.x, -transformedPoint.y);
}

vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy) {
    const vec2 transformedXy = transform.transform(xy);
    const vec2 transformedOrigin = transform.transform(0, 0);
    return transformedXy - transformedOrigin;
}

bool shouldDisregardTransformation(uint32_t source) {
    // Do not apply any transformations to axes from joysticks or touchpads.
    return isFromSource(source, AINPUT_SOURCE_CLASS_JOYSTICK) ||
@@ -114,12 +120,6 @@ int32_t IdGenerator::nextId() const {

// --- InputEvent ---

vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy) {
    const vec2 transformedXy = transform.transform(xy);
    const vec2 transformedOrigin = transform.transform(0, 0);
    return transformedXy - transformedOrigin;
}

const char* inputEventTypeToString(int32_t type) {
    switch (type) {
        case AINPUT_EVENT_TYPE_KEY: {
+1 −2
Original line number Diff line number Diff line
@@ -30,8 +30,7 @@ namespace android {
 * fingers
 *
 * The pointer controller is responsible for providing synchronization and for tracking
 * display orientation changes if needed. It works in the display panel's coordinate space, which
 * is the same coordinate space used by InputReader.
 * display orientation changes if needed.
 */
class PointerControllerInterface {
protected:
+16 −1
Original line number Diff line number Diff line
@@ -188,6 +188,8 @@ void CursorInputMapper::configure(nsecs_t when, const InputReaderConfiguration*

    if (!changes || (changes & InputReaderConfiguration::CHANGE_DISPLAY_INFO)) {
        mOrientation = DISPLAY_ORIENTATION_0;
        mDisplayWidth = 0;
        mDisplayHeight = 0;
        const bool isOrientedDevice =
                (mParameters.orientationAware && mParameters.hasAssociatedDisplay);

@@ -201,6 +203,8 @@ void CursorInputMapper::configure(nsecs_t when, const InputReaderConfiguration*
                    config->getDisplayViewportByType(ViewportType::INTERNAL);
            if (internalViewport) {
                mOrientation = getInverseRotation(internalViewport->orientation);
                mDisplayWidth = internalViewport->deviceWidth;
                mDisplayHeight = internalViewport->deviceHeight;
            }
        }

@@ -331,7 +335,14 @@ void CursorInputMapper::sync(nsecs_t when, nsecs_t readTime) {
            mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);

            if (moved) {
                mPointerController->move(deltaX, deltaY);
                float dx = deltaX;
                float dy = deltaY;
                // Rotate the delta from InputReader's un-rotated coordinate space to
                // PointerController's rotated coordinate space that is oriented with the
                // viewport.
                rotateDelta(getInverseRotation(mOrientation), &dx, &dy);

                mPointerController->move(dx, dy);
            }

            if (buttonsChanged) {
@@ -342,6 +353,10 @@ void CursorInputMapper::sync(nsecs_t when, nsecs_t readTime) {
        }

        mPointerController->getPosition(&xCursorPosition, &yCursorPosition);
        // Rotate the cursor position that is in PointerController's rotated coordinate space
        // to InputReader's un-rotated coordinate space.
        rotatePoint(mOrientation, xCursorPosition /*byRef*/, yCursorPosition /*byRef*/,
                    mDisplayWidth, mDisplayHeight);

        pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, xCursorPosition);
        pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, yCursorPosition);
+2 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ private:
    VelocityControl mWheelYVelocityControl;

    int32_t mOrientation;
    int32_t mDisplayWidth;
    int32_t mDisplayHeight;

    std::shared_ptr<PointerControllerInterface> mPointerController;

Loading