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 | 4fb941a | 2022-12-14 19:14:04 +0000 | [diff] [blame^] | 19 | #include <list> |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 20 | #include <memory> |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 21 | #include <vector> |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 22 | |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 23 | #include <PointerControllerInterface.h> |
| 24 | |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 25 | #include "EventHub.h" |
| 26 | #include "InputDevice.h" |
| 27 | #include "InputMapper.h" |
| 28 | #include "NotifyArgs.h" |
Harry Cutts | 4fb941a | 2022-12-14 19:14:04 +0000 | [diff] [blame^] | 29 | #include "gestures/GestureConverter.h" |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 30 | #include "gestures/HardwareStateConverter.h" |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 31 | |
| 32 | #include "include/gestures.h" |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 33 | |
| 34 | namespace android { |
| 35 | |
| 36 | class TouchpadInputMapper : public InputMapper { |
| 37 | public: |
| 38 | explicit TouchpadInputMapper(InputDeviceContext& deviceContext); |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 39 | ~TouchpadInputMapper(); |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 40 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 41 | uint32_t getSources() const override; |
| 42 | [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; |
| 43 | [[nodiscard]] std::list<NotifyArgs> process(const RawEvent* rawEvent) override; |
| 44 | |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 45 | void consumeGesture(const Gesture* gesture); |
| 46 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 47 | private: |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 48 | [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, |
| 49 | SelfContainedHardwareState schs); |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 50 | [[nodiscard]] std::list<NotifyArgs> processGestures(nsecs_t when, nsecs_t readTime); |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 51 | |
| 52 | std::unique_ptr<gestures::GestureInterpreter, void (*)(gestures::GestureInterpreter*)> |
| 53 | mGestureInterpreter; |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 54 | std::shared_ptr<PointerControllerInterface> mPointerController; |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 55 | |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 56 | HardwareStateConverter mStateConverter; |
Harry Cutts | 4fb941a | 2022-12-14 19:14:04 +0000 | [diff] [blame^] | 57 | GestureConverter mGestureConverter; |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 58 | |
| 59 | bool mProcessing = false; |
| 60 | std::vector<Gesture> mGesturesToProcess; |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace android |