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 <input_manager.h>
20#include <refbase.h>
21
22#include "display_info.h"
23#include "window_root.h"
24#include "wm_common.h"
25
26namespace OHOS {
27namespace Rosen {
28class InputWindowMonitor : public RefBase {
29public:
30    explicit InputWindowMonitor(sptr<WindowRoot>& root) : windowRoot_(root) {}
31    ~InputWindowMonitor() = default;
32    void UpdateInputWindow(uint32_t windowId);
33    void UpdateInputWindowByDisplayId(DisplayId displayId);
34
35private:
36    sptr<WindowRoot> windowRoot_;
37    MMI::DisplayGroupInfo displayGroupInfo_ = {};
38    void TraverseWindowNodes(const std::vector<sptr<WindowNode>>& windowNodes,
39                             std::vector<MMI::WindowInfo>& windowsInfo);
40    void UpdateDisplayGroupInfo(const sptr<WindowNodeContainer>& windowNodeContainer,
41                                MMI::DisplayGroupInfo& displayGroupInfo);
42    void UpdateDisplayInfo(const std::vector<sptr<DisplayInfo>>& displayInfos,
43                           std::vector<MMI::DisplayInfo>& displayInfoVector);
44    MMI::Direction GetDisplayDirectionForMmi(Rotation rotation);
45    void TransformWindowRects(const sptr<WindowNode>& windowNode, Rect& areaRect,
46        std::vector<Rect>& touchHotAreas, std::vector<Rect>& pointerHotAreas);
47};
48}
49}
50#endif // OHOS_INPUT_WINDOW_MONITOR_H
51