• 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 #include "i_pointer_drawing_manager.h"
17 #include "input_event_handler.h"
18 #include "mock_input_windows_manager.h"
19 
20 namespace OHOS {
21 namespace MMI {
22 MockInputWindowsManager *g_inputWindowManagerInterface;
23 
MockInputWindowsManager()24 MockInputWindowsManager::MockInputWindowsManager()
25 {
26     g_inputWindowManagerInterface = this;
27 }
28 
~MockInputWindowsManager()29 MockInputWindowsManager::~MockInputWindowsManager()
30 {
31     g_inputWindowManagerInterface = nullptr;
32 }
33 
GetInputWindowsManagerInterface()34 static InputWindowsManagerInterface *GetInputWindowsManagerInterface()
35 {
36     return g_inputWindowManagerInterface;
37 }
38 
GetEventNormalizeHandler() const39 std::shared_ptr<EventNormalizeHandler> InputEventHandler::GetEventNormalizeHandler() const
40 {
41     if (GetInputWindowsManagerInterface() != nullptr) {
42         return GetInputWindowsManagerInterface()->GetEventNormalizeHandler();
43     }
44     return nullptr;
45 }
46 
GetEventDispatchHandler() const47 std::shared_ptr<EventDispatchHandler> InputEventHandler::GetEventDispatchHandler() const
48 {
49     if (GetInputWindowsManagerInterface() != nullptr) {
50         return GetInputWindowsManagerInterface()->GetEventDispatchHandler();
51     }
52     return nullptr;
53 }
54 
GetUDSServer() const55 UDSServer *InputEventHandler::GetUDSServer() const
56 {
57     if (GetInputWindowsManagerInterface() != nullptr) {
58         return GetInputWindowsManagerInterface()->GetUDSServer();
59     }
60     return nullptr;
61 }
62 
63 #ifdef OHOS_BUILD_ENABLE_ANCO
IsAncoWindow(const WindowInfo & window) const64 bool InputWindowsManager::IsAncoWindow(const WindowInfo &window) const
65 {
66     if (GetInputWindowsManagerInterface() != nullptr) {
67         return GetInputWindowsManagerInterface()->IsAncoWindow(window);
68     }
69     return false;
70 }
71 
UpdateShellWindow(const WindowInfo & window)72 void InputWindowsManager::UpdateShellWindow(const WindowInfo &window) {}
73 #endif // OHOS_BUILD_ENABLE_ANCO
74 
75 } // namespace MMI
76 } // namespace OHOS
77