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

Commit 441a9c28 authored by Jeff Brown's avatar Jeff Brown
Browse files

Fix ABS_MT_SLOT handling.

Shouldn't reset the current slot index to 0 after each SYN_REPORT.

Change-Id: I370e4770f8ae0ce598369ecbaf64772c13e02d46
parent 8f40e587
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -5303,7 +5303,8 @@ MultiTouchInputMapper::~MultiTouchInputMapper() {
}

void MultiTouchInputMapper::clearState() {
    mAccumulator.clear(mSlotCount);
    mAccumulator.clearSlots(mSlotCount);
    mAccumulator.clearButtons();
    mButtonState = 0;
}

@@ -5337,13 +5338,13 @@ void MultiTouchInputMapper::process(const RawEvent* rawEvent) {
        }

        if (mAccumulator.currentSlot < 0 || size_t(mAccumulator.currentSlot) >= mSlotCount) {
            if (newSlot) {
#if DEBUG_POINTERS
            if (newSlot) {
                LOGW("MultiTouch device %s emitted invalid slot index %d but it "
                        "should be between 0 and %d; ignoring this slot.",
                        getDeviceName().string(), mAccumulator.currentSlot, mSlotCount);
#endif
            }
#endif
            break;
        }

@@ -5546,7 +5547,10 @@ void MultiTouchInputMapper::sync(nsecs_t when) {

    syncTouch(when, havePointerIds);

    mAccumulator.clear(mUsingSlotsProtocol ? 0 : mSlotCount);
    if (!mUsingSlotsProtocol) {
        mAccumulator.clearSlots(mSlotCount);
    }
    mAccumulator.clearButtons();
}

void MultiTouchInputMapper::configureRawAxes() {
+5 −3
Original line number Diff line number Diff line
@@ -1235,8 +1235,7 @@ private:
        uint32_t buttonDown;
        uint32_t buttonUp;

        Accumulator() : slots(NULL) {
            clear(false);
        Accumulator() : currentSlot(0), slots(NULL), buttonDown(0), buttonUp(0) {
        }

        ~Accumulator() {
@@ -1247,11 +1246,14 @@ private:
            slots = new Slot[slotCount];
        }

        void clear(size_t slotCount) {
        void clearSlots(size_t slotCount) {
            for (size_t i = 0; i < slotCount; i++) {
                slots[i].clear();
            }
            currentSlot = 0;
        }

        void clearButtons() {
            buttonDown = 0;
            buttonUp = 0;
        }