• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef TOUCHPAD_TRANSFORM_PROCESSOR_H
16 #define TOUCHPAD_TRANSFORM_PROCESSOR_H
17 #include "nocopyable.h"
18 #include "transform_processor.h"
19 
20 namespace OHOS {
21 namespace MMI {
22 class TouchPadTransformProcessor : public TransformProcessor {
23 public:
24     explicit TouchPadTransformProcessor(int32_t deviceId);
25     DISALLOW_COPY_AND_MOVE(TouchPadTransformProcessor);
26     virtual ~TouchPadTransformProcessor() = default;
27     std::shared_ptr<PointerEvent> OnEvent(struct libinput_event *event) override;
28 
29 private:
30     void OnEventTouchPadDown(struct libinput_event *event);
31     void OnEventTouchPadMotion(struct libinput_event *event);
32     void OnEventTouchPadUp(struct libinput_event *event);
33     int32_t GetTouchPadToolType(struct libinput_event_touch *data, struct libinput_device *device);
34     int32_t GetTouchPadToolType(struct libinput_device *device);
35     void InitToolType();
36 private:
37     const int32_t deviceId_ { -1 };
38     std::shared_ptr<PointerEvent> pointerEvent_ { nullptr };
39     std::vector<std::pair<int32_t, int32_t>> vecToolType_;
40 };
41 } // namespace MMI
42 } // namespace OHOS
43 #endif // TOUCHPAD_TRANSFORM_PROCESSOR_H