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" |
Harry Cutts | edf6ce7 | 2023-01-04 12:15:53 +0000 | [diff] [blame] | 28 | #include "InputReaderBase.h" |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 29 | #include "NotifyArgs.h" |
Harry Cutts | 4fb941a | 2022-12-14 19:14:04 +0000 | [diff] [blame] | 30 | #include "gestures/GestureConverter.h" |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 31 | #include "gestures/HardwareStateConverter.h" |
Harry Cutts | 1b21791 | 2023-01-03 17:13:19 +0000 | [diff] [blame] | 32 | #include "gestures/PropertyProvider.h" |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 33 | |
| 34 | #include "include/gestures.h" |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 35 | |
| 36 | namespace android { |
| 37 | |
| 38 | class TouchpadInputMapper : public InputMapper { |
| 39 | public: |
| 40 | explicit TouchpadInputMapper(InputDeviceContext& deviceContext); |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 41 | ~TouchpadInputMapper(); |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 42 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 43 | uint32_t getSources() const override; |
Harry Cutts | d02ea10 | 2023-03-17 18:21:30 +0000 | [diff] [blame] | 44 | void populateDeviceInfo(InputDeviceInfo& deviceInfo) override; |
Harry Cutts | ea73eaa | 2023-01-16 17:55:46 +0000 | [diff] [blame] | 45 | void dump(std::string& dump) override; |
| 46 | |
Arpit Singh | 4be4eef | 2023-03-28 14:26:01 +0000 | [diff] [blame^] | 47 | [[nodiscard]] std::list<NotifyArgs> reconfigure(nsecs_t when, |
| 48 | const InputReaderConfiguration* config, |
| 49 | uint32_t changes) override; |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 50 | [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; |
| 51 | [[nodiscard]] std::list<NotifyArgs> process(const RawEvent* rawEvent) override; |
| 52 | |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 53 | void consumeGesture(const Gesture* gesture); |
| 54 | |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 55 | private: |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 56 | [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, |
| 57 | SelfContainedHardwareState schs); |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 58 | [[nodiscard]] std::list<NotifyArgs> processGestures(nsecs_t when, nsecs_t readTime); |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 59 | |
| 60 | std::unique_ptr<gestures::GestureInterpreter, void (*)(gestures::GestureInterpreter*)> |
| 61 | mGestureInterpreter; |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 62 | std::shared_ptr<PointerControllerInterface> mPointerController; |
Harry Cutts | 1f48a44 | 2022-11-15 17:38:36 +0000 | [diff] [blame] | 63 | |
Harry Cutts | 1b21791 | 2023-01-03 17:13:19 +0000 | [diff] [blame] | 64 | PropertyProvider mPropertyProvider; |
| 65 | |
Harry Cutts | 47db1c7 | 2022-12-13 19:20:47 +0000 | [diff] [blame] | 66 | HardwareStateConverter mStateConverter; |
Harry Cutts | 4fb941a | 2022-12-14 19:14:04 +0000 | [diff] [blame] | 67 | GestureConverter mGestureConverter; |
Harry Cutts | 7423554 | 2022-11-24 15:52:53 +0000 | [diff] [blame] | 68 | |
| 69 | bool mProcessing = false; |
| 70 | std::vector<Gesture> mGesturesToProcess; |
Harry Cutts | 79cc9fa | 2022-10-28 15:32:39 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | } // namespace android |