• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 UPDATER_UI_POINTERS_INPUT_DEVICE_H
16 #define UPDATER_UI_POINTERS_INPUT_DEVICE_H
17 #include <linux/input.h>
18 #include "macros_updater.h"
19 #include "dock/pointer_input_device.h"
20 #include "dock/input_device.h"
21 
22 namespace Updater {
23 void AddInputDevice();
24 void HandlePointersEvent(const input_event &ev, uint32_t type);
25 class PointersInputDevice : public OHOS::PointerInputDevice {
26     DISALLOW_COPY_MOVE(PointersInputDevice);
27 public:
28     PointersInputDevice() = default;
29     virtual ~PointersInputDevice() = default;
30     static PointersInputDevice &GetInstance();
31     bool Read(OHOS::DeviceData &data) override;
32     bool ReadPoint(OHOS::DeviceData& data, OHOS::Point pos, bool fingerPressDown);
33     bool ReadTouch(OHOS::DeviceData &data);
34     void SetFingerDown(bool isPressed);
35     int HandlePointEvent(const input_event &ev, uint32_t type);
36     void HandleEvAbsMt(const input_event &ev);
37 
38 private:
39     OHOS::Point reportAbsMt_ {};
40     bool touchFingerDown_ { false };
41 };
42 } // namespace Updater
43 #endif // UPDATER_UI_POINTERS_INPUT_DEVICE_H