Debian Codegraph @

xbmc/windowing/wayland/WinSystemWaylandWebOS.h

raw
1 /*
2 * Copyright (C) 2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "Registry.h"
12 #include "WinSystemWayland.h"
13
14 #include <wayland-webos-protocols.hpp>
15 #include <webos-helpers/libhelpers.h>
16
17 namespace KODI::WINDOWING::WAYLAND
18 {
19
20 class CWinSystemWaylandWebOS : public CWinSystemWayland
21 {
22
23 public:
24 bool InitWindowSystem() override;
25
26 /**
27 * Gets the exported window name. May return an empty string on non wayland-webos-foreign devices (pre webOS 5)
28 * @return Exported window name
29 */
30 std::string GetExportedWindowName();
31
32 /**
33 * Sets up the an exported window for display. The display engine will merge the exported window with the UI layer.
34 * Therefore any UI element must be transparent for the exported window to punch through. Not available on non
35 * wayland-webos-foreign devices (pre webOS 5)
36 * @param src Original source window rect (video size)
37 * @param src Source window rect crop window
38 * @param dst Destination rect
39 * @return True on success, else false
40 */
41 bool SetExportedWindow(CRect orig, CRect src, CRect dest);
42
43 bool SupportsExportedWindow();
44
45 IShellSurface* CreateShellSurface(const std::string& name) override;
46 bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
47 ~CWinSystemWaylandWebOS() noexcept override;
48 bool HasCursor() override;
49 void OnConfigure(std::uint32_t serial, CSizeInt size, IShellSurface::StateBitset state) override;
50
51 protected:
52 std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override;
53
54 private:
55 static bool OnAppLifecycleEventWrapper(LSHandle* sh, LSMessage* reply, void* ctx);
56 bool OnAppLifecycleEvent(LSHandle* sh, LSMessage* reply);
57
58 std::unique_ptr<CRegistry> m_webosRegistry;
59
60 // WebOS foreign surface
61 std::string m_exportedWindowName;
62 wayland::compositor_t m_compositor;
63 wayland::webos_exported_t m_exportedSurface;
64 wayland::webos_foreign_t m_webosForeign;
65
66 std::unique_ptr<HContext, int (*)(HContext*)> m_requestContext{new HContext(),
67 HUnregisterServiceCallback};
68
69 bool m_resumePlayback{false};
70 };
71
72 } // namespace KODI::WINDOWING::WAYLAND