kodi
ShellSurface.h
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 "utils/Geometry.h"
12 
13 #include <bitset>
14 #include <cstdint>
15 
16 #include <wayland-client.hpp>
17 
18 namespace KODI
19 {
20 namespace WINDOWING
21 {
22 namespace WAYLAND
23 {
24 
25 class IShellSurfaceHandler;
26 
35 {
36 public:
37  // Not enum class since it must be used like a bitfield
38  enum State
39  {
40  STATE_MAXIMIZED = 0,
41  STATE_FULLSCREEN,
42  STATE_RESIZING,
43  STATE_ACTIVATED,
44  STATE_COUNT
45  };
46  using StateBitset = std::bitset<STATE_COUNT>;
47  static std::string StateToString(StateBitset state);
48 
56  virtual void Initialize() = 0;
57 
58  virtual void SetFullScreen(wayland::output_t const& output, float refreshRate) = 0;
59  virtual void SetWindowed() = 0;
60  virtual void SetMaximized() = 0;
61  virtual void UnsetMaximized() = 0;
62  virtual void SetMinimized() = 0;
63  virtual void SetWindowGeometry(CRectInt geometry) = 0;
64 
65  virtual void AckConfigure(std::uint32_t serial) = 0;
66 
67  virtual void StartMove(wayland::seat_t const& seat, std::uint32_t serial) = 0;
68  virtual void StartResize(wayland::seat_t const& seat, std::uint32_t serial, wayland::shell_surface_resize edge) = 0;
69  virtual void ShowShellContextMenu(wayland::seat_t const& seat, std::uint32_t serial, CPointInt position) = 0;
70 
71  virtual ~IShellSurface() = default;
72 
73 protected:
74  IShellSurface() noexcept = default;
75 
76 private:
77  IShellSurface(IShellSurface const& other) = delete;
78  IShellSurface& operator=(IShellSurface const& other) = delete;
79 };
80 
82 {
83 public:
84  virtual void OnConfigure(std::uint32_t serial, CSizeInt size, IShellSurface::StateBitset state) = 0;
85  virtual void OnClose() = 0;
86 
87  virtual ~IShellSurfaceHandler() = default;
88 };
89 
90 }
91 }
92 }
Definition: AudioDecoder.h:18
Abstraction for shell surfaces to support multiple protocols such as wl_shell (for compatibility) and...
Definition: ShellSurface.h:34
virtual void Initialize()=0
Initialize shell surface.