/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_IMPL_H #define FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_IMPL_H #include #include #include #include #include "singleton_delegator.h" #include "wayland_service.h" #include "window_manager_server.h" #include "wl_buffer_cache.h" #include "wl_display.h" #include "wl_dma_buffer_factory.h" #include "wl_shm_buffer_factory.h" #include "wl_subsurface_factory.h" #include "wl_surface_factory.h" namespace OHOS { class WindowManagerImpl : public WindowManager { public: static sptr GetInstance(); virtual GSError Init() override; virtual GSError GetDisplays(std::vector &displays) const override; virtual sptr GetWindowByID(int32_t wid) override; virtual GSError CreateWindow(sptr &window, const sptr &option) override; virtual GSError CreateSubwindow(sptr &subwindow, const sptr &window, const sptr &option) override; virtual GSError ListenNextScreenShot(int32_t id, IScreenShotCallback *cb) override; virtual GSError ListenNextWindowShot(const sptr &window, IWindowShotCallback *cb) override; virtual GSError CreateVirtualDisplay(const sptr &option) override; virtual GSError DestroyVirtualDisplay(uint32_t did) override; virtual GSError SetDisplayMode(WMSDisplayMode mode) override; private: WindowManagerImpl(); virtual ~WindowManagerImpl() override; static inline sptr instance = nullptr; static inline SingletonDelegator wmscDelegator; void InitSingleton(); void DeinitSingleton(); void Deinit(); std::mutex initMutex; bool init = false; bool initSingleton = false; sptr wmservice = nullptr; using WptrWindow = wptr; std::vector windowCache; sptr display = nullptr; sptr wlBufferCache = nullptr; sptr wlDMABufferFactory = nullptr; sptr wlSHMBufferFactory = nullptr; sptr wlSubsurfaceFactory = nullptr; sptr wlSurfaceFactory = nullptr; sptr windowManagerServer = nullptr; sptr waylandService = nullptr; sptr wmsc = nullptr; }; } // namespace OHOS #endif // FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_IMPL_H