Debian Codegraph @

xbmc/windowing/wayland/ShellSurfaceXdgShell.h

raw
1 /*
2 * Copyright (C) 2017-2018 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 "Connection.h"
12 #include "ShellSurface.h"
13
14 #include <wayland-extra-protocols.hpp>
15
16 namespace KODI
17 {
18 namespace WINDOWING
19 {
20 namespace WAYLAND
21 {
22
23 /**
24 * Shell surface implementation for stable xdg_shell
25 */
26 class CShellSurfaceXdgShell : public IShellSurface
27 {
28 public:
29 /**
30 * Construct xdg_shell toplevel object for given surface
31 *
32 * \param handler the shell surface handler
33 * \param display the wl_display global (for initial roundtrip)
34 * \param shell the xdg_wm_base global
35 * \param surface surface to make shell surface for
36 * \param title title of the surfae
37 * \param class_ class of the surface, which should match the name of the
38 * .desktop file of the application
39 */
40 CShellSurfaceXdgShell(IShellSurfaceHandler& handler, wayland::display_t& display, wayland::xdg_wm_base_t const& shell, wayland::surface_t const& surface, std::string const& title, std::string const& class_);
41 ~CShellSurfaceXdgShell() noexcept override;
42
43 static CShellSurfaceXdgShell* TryCreate(IShellSurfaceHandler& handler, CConnection& connection, wayland::surface_t const& surface, std::string const& title, std::string const& class_);
44
45 void Initialize() override;
46
47 void SetFullScreen(wayland::output_t const& output, float refreshRate) override;
48 void SetWindowed() override;
49 void SetMaximized() override;
50 void UnsetMaximized() override;
51 void SetMinimized() override;
52 void SetWindowGeometry(CRectInt geometry) override;
53 void AckConfigure(std::uint32_t serial) override;
54
55 void StartMove(const wayland::seat_t& seat, std::uint32_t serial) override;
56 void StartResize(const wayland::seat_t& seat, std::uint32_t serial, wayland::shell_surface_resize edge) override;
57 void ShowShellContextMenu(const wayland::seat_t& seat, std::uint32_t serial, CPointInt position) override;
58
59 private:
60 IShellSurfaceHandler& m_handler;
61 wayland::display_t& m_display;
62 wayland::xdg_wm_base_t m_shell;
63 wayland::surface_t m_surface;
64 wayland::xdg_surface_t m_xdgSurface;
65 wayland::xdg_toplevel_t m_xdgToplevel;
66
67 CSizeInt m_configuredSize;
68 StateBitset m_configuredState;
69 };
70
71 }
72 }
73 }