1 /*
2  * Copyright (c) 2020-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 #include "lite_proxy_windows_manager.h"
17 
18 #include "gfx_utils/color.h"
19 #include "gfx_utils/graphic_log.h"
20 #include "lite_wm_requestor.h"
21 #include "lite_wms_client.h"
22 
23 namespace OHOS {
Init()24 int LiteProxyWindowsManager::Init()
25 {
26     GRAPHIC_LOGI("Init");
27     LiteWMSClient::GetInstance()->InitLiteWMSClient();
28     LiteWMRequestor* requestor = LiteWMRequestor::GetInstance();
29     requestor->ClientRegister();
30     requestor->GetLayerInfo();
31     return 0;
32 }
33 
CreateWindow(const LiteWinConfig & config)34 IWindow* LiteProxyWindowsManager::CreateWindow(const LiteWinConfig& config)
35 {
36     LiteWinRequestor* requstor = LiteWMRequestor::GetInstance()->CreateWindow(config);
37     if (requstor == nullptr) {
38         return nullptr;
39     } else {
40         return new LiteProxyWindow(requstor);
41     }
42 }
43 
RemoveWindow(IWindow * win)44 void LiteProxyWindowsManager::RemoveWindow(IWindow* win)
45 {
46     if (win != nullptr) {
47         int32_t id = win->GetWindowId();
48         delete win;
49         LiteWMRequestor::GetInstance()->RemoveWindow(id);
50     }
51 }
52 
GetEventData(DeviceData * data)53 void LiteProxyWindowsManager::GetEventData(DeviceData* data)
54 {
55     LiteWMRequestor::GetInstance()->GetEventData(data);
56 }
57 
Screenshot()58 void LiteProxyWindowsManager::Screenshot()
59 {
60     LiteWMRequestor::GetInstance()->Screenshot();
61 }
62 
SetScreenshotListener(ScreenshotListener * listener)63 void LiteProxyWindowsManager::SetScreenshotListener(ScreenshotListener* listener)
64 {
65     LiteWMRequestor::GetInstance()->SetScreenshotListener(listener);
66 }
67 } // namespace OHOS