| 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 unstable xdg_shell in version 6 |
| 25 |
* |
| 26 |
* xdg_shell was accepted as a stable protocol in wayland-protocols, which |
| 27 |
* means this class is deprecated and can be safely removed once the relevant |
| 28 |
* compositors have made the switch. |
| 29 |
*/ |
| 30 |
class CShellSurfaceXdgShellUnstableV6 : public IShellSurface |
| 31 |
{ |
| 32 |
public: |
| 33 |
/** |
| 34 |
* Construct xdg_shell toplevel object for given surface |
| 35 |
* |
| 36 |
* \param handler the shell surface handler |
| 37 |
* \param display the wl_display global (for initial roundtrip) |
| 38 |
* \param shell the zxdg_shell_v6 global |
| 39 |
* \param surface surface to make shell surface for |
| 40 |
* \param title title of the surfae |
| 41 |
* \param class_ class of the surface, which should match the name of the |
| 42 |
* .desktop file of the application |
| 43 |
*/ |
| 44 |
CShellSurfaceXdgShellUnstableV6(IShellSurfaceHandler& handler, wayland::display_t& display, wayland::zxdg_shell_v6_t const& shell, wayland::surface_t const& surface, std::string const& title, std::string const& class_); |
| 45 |
~CShellSurfaceXdgShellUnstableV6() noexcept override; |
| 46 |
|
| 47 |
static CShellSurfaceXdgShellUnstableV6* TryCreate(IShellSurfaceHandler& handler, CConnection& connection, wayland::surface_t const& surface, std::string const& title, std::string const& class_); |
| 48 |
|
| 49 |
void Initialize() override; |
| 50 |
|
| 51 |
void SetFullScreen(wayland::output_t const& output, float refreshRate) override; |
| 52 |
void SetWindowed() override; |
| 53 |
void SetMaximized() override; |
| 54 |
void UnsetMaximized() override; |
| 55 |
void SetMinimized() override; |
| 56 |
void SetWindowGeometry(CRectInt geometry) override; |
| 57 |
void AckConfigure(std::uint32_t serial) override; |
| 58 |
|
| 59 |
void StartMove(const wayland::seat_t& seat, std::uint32_t serial) override; |
| 60 |
void StartResize(const wayland::seat_t& seat, std::uint32_t serial, wayland::shell_surface_resize edge) override; |
| 61 |
void ShowShellContextMenu(const wayland::seat_t& seat, std::uint32_t serial, CPointInt position) override; |
| 62 |
|
| 63 |
private: |
| 64 |
IShellSurfaceHandler& m_handler; |
| 65 |
wayland::display_t& m_display; |
| 66 |
wayland::zxdg_shell_v6_t m_shell; |
| 67 |
wayland::surface_t m_surface; |
| 68 |
wayland::zxdg_surface_v6_t m_xdgSurface; |
| 69 |
wayland::zxdg_toplevel_v6_t m_xdgToplevel; |
| 70 |
|
| 71 |
CSizeInt m_configuredSize; |
| 72 |
StateBitset m_configuredState; |
| 73 |
}; |
| 74 |
|
| 75 |
} |
| 76 |
} |
| 77 |
} |