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

Commit 4866f087 authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Use previous pressure value if the current fusion data is zero." into mnc-dev

parents 4eed0f8f 53dca3aa
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -4076,14 +4076,20 @@ void TouchInputMapper::applyExternalStylusButtonState(nsecs_t when) {
}
}


void TouchInputMapper::applyExternalStylusTouchState(nsecs_t when) {
void TouchInputMapper::applyExternalStylusTouchState(nsecs_t when) {
    CookedPointerData& cpd = mCurrentCookedState.cookedPointerData;
    CookedPointerData& currentPointerData = mCurrentCookedState.cookedPointerData;
    if (mExternalStylusId != -1 && cpd.isTouching(mExternalStylusId)) {
    const CookedPointerData& lastPointerData = mLastCookedState.cookedPointerData;
        if (mExternalStylusState.pressure != 0.0f) {

            PointerCoords& coords = cpd.editPointerCoordsWithId(mExternalStylusId);
    if (mExternalStylusId != -1 && currentPointerData.isTouching(mExternalStylusId)) {
            coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, mExternalStylusState.pressure);
        float pressure = mExternalStylusState.pressure;
        if (pressure == 0.0f && lastPointerData.isTouching(mExternalStylusId)) {
            const PointerCoords& coords = lastPointerData.pointerCoordsForId(mExternalStylusId);
            pressure = coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE);
        }
        }
        PointerCoords& coords = currentPointerData.editPointerCoordsWithId(mExternalStylusId);
        coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure);


        PointerProperties& properties = cpd.editPointerPropertiesWithId(mExternalStylusId);
        PointerProperties& properties =
                currentPointerData.editPointerPropertiesWithId(mExternalStylusId);
        if (mExternalStylusState.toolType != AMOTION_EVENT_TOOL_TYPE_UNKNOWN) {
        if (mExternalStylusState.toolType != AMOTION_EVENT_TOOL_TYPE_UNKNOWN) {
            properties.toolType = mExternalStylusState.toolType;
            properties.toolType = mExternalStylusState.toolType;
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -881,11 +881,11 @@ struct CookedPointerData {
        return pointerProperties[idToIndex[id]];
        return pointerProperties[idToIndex[id]];
    }
    }


    inline bool isHovering(uint32_t pointerIndex) {
    inline bool isHovering(uint32_t pointerIndex) const {
        return hoveringIdBits.hasBit(pointerProperties[pointerIndex].id);
        return hoveringIdBits.hasBit(pointerProperties[pointerIndex].id);
    }
    }


    inline bool isTouching(uint32_t pointerIndex) {
    inline bool isTouching(uint32_t pointerIndex) const {
        return touchingIdBits.hasBit(pointerProperties[pointerIndex].id);
        return touchingIdBits.hasBit(pointerProperties[pointerIndex].id);
    }
    }
};
};