• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 
16 #ifndef FOLDING_AREA_TOAST_H
17 #define FOLDING_AREA_TOAST_H
18 #include <unordered_map>
19 #include <vector>
20 #include "nocopyable.h"
21 #include "libinput.h"
22 namespace OHOS {
23 namespace MMI {
24 class FoldingAreaToast final {
25 public:
26     FoldingAreaToast();
27     ~FoldingAreaToast();
28     DISALLOW_COPY_AND_MOVE(FoldingAreaToast);
29     void FoldingAreaProcess(struct libinput_event *event);
30 
31 private:
32     int32_t deviceId_;
33     std::unordered_map<int32_t, uint16_t> touchId2KeepFrames_;
34     std::unordered_map<int32_t, int64_t> touchId2FirstDownTimes_;
35     std::unordered_map<int32_t, uint16_t> touchId2KeepDownTimes_;
36     std::unordered_map<int32_t, std::pair<uint16_t, uint16_t>> touchId2clickTouchs_;
37     std::vector<std::pair<uint16_t, uint16_t>> tacTouchs_;
38     std::unordered_map<int32_t, uint16_t> touchId2touchNum_;
39     int64_t clickInFoldingAreaBeginTimeStamp_ = 0;
40     int32_t touchId_ = 0;
41     uint16_t pointX_ = 0;
42     uint16_t pointY_ = 0;
43 
44 private:
45     void NotifyFoldingAreaTouchStatus(const int8_t state);
46     void FoldingAreaClear(void);
47     void FoldingAreaGetTouchid2TouchNum(void);
48     void FoldingAreaLongPressProcess(void);
49     void FoldingAreaFastClickProcess(void);
50     void FoldingAreaCheckDeviceId(struct libinput_event *event);
51 };
52 } // namespace MMI
53 } // namespace OHOS
54 #endif // FOLDING_AREA_TOAST_H