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

Commit a32a1198 authored by Harry Cutts's avatar Harry Cutts
Browse files

InputMapper: pass RawEvent references instead of pointers

We never pass null values here, so changing to references makes this
clearer.

Change-Id: I82d5359e244a93560bcbef477c89fef016168abb
Test: atest inputflinger_test
Test: m checkinput
Test: manually test basic functionality on a multi-touch screen, touchpad, mouse, and drawing tablet
Bug: 245989146
Flag: EXEMPT refactor
parent 71953c2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ std::list<NotifyArgs> InputDevice::process(const RawEvent* rawEvents, size_t cou
            mDropUntilNextSync = true;
        } else {
            for_each_mapper_in_subdevice(rawEvent->deviceId, [&](InputMapper& mapper) {
                out += mapper.process(rawEvent);
                out += mapper.process(*rawEvent);
            });
        }
        --count;
+6 −6
Original line number Diff line number Diff line
@@ -215,16 +215,16 @@ std::list<NotifyArgs> CursorInputMapper::reset(nsecs_t when) {
    return InputMapper::reset(when);
}

std::list<NotifyArgs> CursorInputMapper::process(const RawEvent* rawEvent) {
std::list<NotifyArgs> CursorInputMapper::process(const RawEvent& rawEvent) {
    std::list<NotifyArgs> out;
    mCursorButtonAccumulator.process(*rawEvent);
    mCursorMotionAccumulator.process(*rawEvent);
    mCursorScrollAccumulator.process(*rawEvent);
    mCursorButtonAccumulator.process(rawEvent);
    mCursorMotionAccumulator.process(rawEvent);
    mCursorScrollAccumulator.process(rawEvent);

    if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
    if (rawEvent.type == EV_SYN && rawEvent.code == SYN_REPORT) {
        const auto [eventTime, readTime] =
                applyBluetoothTimestampSmoothening(getDeviceContext().getDeviceIdentifier(),
                                                   rawEvent->when, rawEvent->readTime,
                                                   rawEvent.when, rawEvent.readTime,
                                                   mLastEventTime);
        out += sync(eventTime, readTime);
        mLastEventTime = eventTime;
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public:
                                                    const InputReaderConfiguration& readerConfig,
                                                    ConfigurationChanges changes) override;
    [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override;
    [[nodiscard]] std::list<NotifyArgs> process(const RawEvent* rawEvent) override;
    [[nodiscard]] std::list<NotifyArgs> process(const RawEvent& rawEvent) override;

    virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode) override;

+5 −5
Original line number Diff line number Diff line
@@ -61,13 +61,13 @@ std::list<NotifyArgs> ExternalStylusInputMapper::reset(nsecs_t when) {
    return InputMapper::reset(when);
}

std::list<NotifyArgs> ExternalStylusInputMapper::process(const RawEvent* rawEvent) {
std::list<NotifyArgs> ExternalStylusInputMapper::process(const RawEvent& rawEvent) {
    std::list<NotifyArgs> out;
    mSingleTouchMotionAccumulator.process(*rawEvent);
    mTouchButtonAccumulator.process(*rawEvent);
    mSingleTouchMotionAccumulator.process(rawEvent);
    mTouchButtonAccumulator.process(rawEvent);

    if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
        out += sync(rawEvent->when);
    if (rawEvent.type == EV_SYN && rawEvent.code == SYN_REPORT) {
        out += sync(rawEvent.when);
    }
    return out;
}
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public:
                                                    const InputReaderConfiguration& config,
                                                    ConfigurationChanges changes) override;
    [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override;
    [[nodiscard]] std::list<NotifyArgs> process(const RawEvent* rawEvent) override;
    [[nodiscard]] std::list<NotifyArgs> process(const RawEvent& rawEvent) override;

private:
    SingleTouchMotionAccumulator mSingleTouchMotionAccumulator;
Loading