• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 OHOS_INPUT_WINDOW_MONITOR_H
17 #define OHOS_INPUT_WINDOW_MONITOR_H
18 
19 #include <unordered_set>
20 #include <input_manager.h>
21 #include <refbase.h>
22 
23 #include "window_root.h"
24 #include "wm_common.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 class InputWindowMonitor : public RefBase {
29 public:
InputWindowMonitor(sptr<WindowRoot> & root)30     InputWindowMonitor(sptr<WindowRoot>& root) : windowRoot_(root) {}
31     ~InputWindowMonitor() = default;
32     void UpdateInputWindow(uint32_t windowId);
33     void UpdateInputWindowByDisplayId(DisplayId displayId);
34 
35 private:
36     sptr<WindowRoot> windowRoot_;
37     std::vector<MMI::PhysicalDisplayInfo> physicalDisplays_;
38     std::vector<MMI::LogicalDisplayInfo> logicalDisplays_;
39     std::unordered_set<WindowType> windowTypeSkipped_ { WindowType::WINDOW_TYPE_POINTER,
40         WindowType::WINDOW_TYPE_DRAGGING_EFFECT };
41     const int INVALID_WINDOW_ID = -1;
42     void TraverseWindowNodes(const std::vector<sptr<WindowNode>>& windowNodes,
43                               std::vector<MMI::LogicalDisplayInfo>::iterator& iter);
44     void UpdateDisplaysInfo(const sptr<WindowNodeContainer>& container, DisplayId displayId);
45     void UpdateDisplayDirection(MMI::PhysicalDisplayInfo& physicalDisplayInfo, DisplayId displayId);
46 };
47 }
48 }
49 #endif // OHOS_INPUT_WINDOW_MONITOR_H
50