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

Commit 517f46af authored by Hiroki Sato's avatar Hiroki Sato
Browse files

Simplify adding FLAG_IS_GENERATED_GESTURE in GestureConverter

This ensures that IS_GENERATED_GESTURE flag is always added when the
gesture is two fingers scroll.

With this change, FLAG_IS_GENERATED_GESTURE is added to fling stops.

Bug: 364460018
Test: GestureConverterTest
Flag: NONE very minor behaviour change
Change-Id: If18f65395e3a2d3eabf514a1fe8660de2a165978
parent dd62ddc2
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -354,7 +354,6 @@ std::list<NotifyArgs> GestureConverter::handleScroll(nsecs_t when, nsecs_t readT
        NotifyMotionArgs args =
                makeMotionArgs(when, readTime, AMOTION_EVENT_ACTION_DOWN, /* actionButton= */ 0,
                               mButtonState, /* pointerCount= */ 1, mFakeFingerCoords.data());
        args.flags |= AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE;
        out.push_back(args);
    }
    float deltaX = gesture.details.scroll.dx;
@@ -369,7 +368,6 @@ std::list<NotifyArgs> GestureConverter::handleScroll(nsecs_t when, nsecs_t readT
    NotifyMotionArgs args =
            makeMotionArgs(when, readTime, AMOTION_EVENT_ACTION_MOVE, /* actionButton= */ 0,
                           mButtonState, /* pointerCount= */ 1, mFakeFingerCoords.data());
    args.flags |= AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE;
    out.push_back(args);
    return out;
}
@@ -443,7 +441,6 @@ std::list<NotifyArgs> GestureConverter::endScroll(nsecs_t when, nsecs_t readTime
    NotifyMotionArgs args =
            makeMotionArgs(when, readTime, AMOTION_EVENT_ACTION_UP, /* actionButton= */ 0,
                           mButtonState, /* pointerCount= */ 1, mFakeFingerCoords.data());
    args.flags |= AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE;
    out.push_back(args);
    mCurrentClassification = MotionClassification::NONE;
    out += enterHover(when, readTime);
@@ -647,6 +644,10 @@ NotifyMotionArgs GestureConverter::makeMotionArgs(nsecs_t when, nsecs_t readTime
    if (mEnableNoFocusChange && isGestureNoFocusChange(mCurrentClassification)) {
        flags |= AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE;
    }
    if (mCurrentClassification == MotionClassification::TWO_FINGER_SWIPE) {
        // This helps to make GestureDetector responsive.
        flags |= AMOTION_EVENT_FLAG_IS_GENERATED_GESTURE;
    }

    return {mReaderContext.getNextId(),
            when,