Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame^] | 19 | #include <memory> |
| 20 | |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 21 | #include "EventHub.h" |
| 22 | #include "InputDevice.h" |
| 23 | #include "InputMapper.h" |
| 24 | #include "NotifyArgs.h" |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame^] | 25 | #include "accumulator/CursorButtonAccumulator.h" |
| 26 | #include "accumulator/MultiTouchMotionAccumulator.h" |
| 27 | #include "accumulator/TouchButtonAccumulator.h" |
| 28 | |
| 29 | #include "include/gestures.h" |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 30 | |
| 31 | namespace android { |
| 32 | |
| 33 | class TouchpadInputMapper : public InputMapper { |
| 34 | public: |
| 35 | explicit TouchpadInputMapper(InputDeviceContext& deviceContext); |
| 36 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame^] | 37 | uint32_t getSources() const override; |
| 38 | [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; |
| 39 | [[nodiscard]] std::list<NotifyArgs> process(const RawEvent* rawEvent) override; |
| 40 | |
| 41 | private: |
| 42 | void sync(nsecs_t when); |
| 43 | |
| 44 | std::unique_ptr<gestures::GestureInterpreter, void (*)(gestures::GestureInterpreter*)> |
| 45 | mGestureInterpreter; |
| 46 | |
| 47 | CursorButtonAccumulator mCursorButtonAccumulator; |
| 48 | MultiTouchMotionAccumulator mMotionAccumulator; |
| 49 | TouchButtonAccumulator mTouchButtonAccumulator; |
| 50 | int32_t mMscTimestamp = 0; |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // namespace android |