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

Commit 60a126a4 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Fix ABS_MT_SLOT handling."

parents 501017eb 441a9c28
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -5376,7 +5376,8 @@ MultiTouchInputMapper::~MultiTouchInputMapper() {
}

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

@@ -5410,13 +5411,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;
        }

@@ -5619,7 +5620,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
@@ -1243,8 +1243,7 @@ private:
        uint32_t buttonDown;
        uint32_t buttonUp;

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

        ~Accumulator() {
@@ -1255,11 +1254,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;
        }