EHS
Window_Way.h
Go to the documentation of this file.
1#pragma once
2
3#include "BaseWindow.h"
4
5#include <wayland-client.h>
7#include "xdg-decoration.h"
8
9namespace ehs
10{
11 class EHS_LIB_IO Window : public BaseWindow
12 {
13 protected:
14 wl_display *display;
15 wl_registry *registry;
16 wl_compositor *compositor;
17 wl_surface *wlSurface;
18 xdg_wm_base *xdgShell;
19 xdg_surface *xdgSurface;
20 xdg_toplevel *xdgToplevel;
21 zxdg_decoration_manager_v1 *decManager;
22 zxdg_toplevel_decoration_v1 *dec;
23 wl_seat *seat;
24 wl_pointer *pointer;
26
27 static void SurfaceConfigEvent(void *data, xdg_surface *xdg_surface, UInt_32 serial);
28
29 static void ShellPing(void *data, xdg_wm_base *shell, UInt_32 serial);
30
31 static void RegistryHandler(void *data, wl_registry *registry, UInt_32 id, const char *interface, UInt_32 version);
32
33 static void RegistryRemoved(void *data, wl_registry *registry, UInt_32 id);
34
35 static void ResizeEvent(void *data, xdg_toplevel *xdg_toplevel, Int_32 width, Int_32 height, wl_array *states);
36
37 static void CloseEvent(void *data, xdg_toplevel *xdg_toplevel);
38
39 static void SeatCapabilitiesEvent(void *data, wl_seat *seat, UInt_32 capabilities);
40
41 static void PointerMotionEvent(void *data, wl_pointer *pointer, UInt_32 time, wl_fixed_t sx, wl_fixed_t sy);
42
43 public:
44 ~Window() override;
45
47
48 Window(Window &&win) noexcept;
49
50 Window(const Window &win);
51
52 Window &operator=(Window &&win) noexcept;
53
54 Window &operator=(const Window &win);
55
56 void Create_32(const Str_32& title, const Vec2_s32& pos, Vec2_u32 scale) override;
57
58 void Create_16(const Str_16& title, const Vec2_s32& pos, Vec2_u32 scale) override;
59
60 void Create_8(const Str_8& title, const Vec2_s32& pos, Vec2_u32 scale) override;
61
62 void OnCreated() override;
63
64 void Close() override;
65
66 void Show() override;
67
68 void Hide() override;
69
70 bool Poll() override;
71
72 void ShowCursor(bool toggle) override;
73
74 void ConstrainCursor(const bool constrain) override;
75
76 void SetTitle_32(const Str_32& newTitle) override;
77
78 Str_32 GetTitle_32() const override;
79
80 void SetTitle_16(const Str_16& newTitle) override;
81
82 Str_16 GetTitle_16() const override;
83
84 void SetTitle_8(const Str_8& newTitle) override;
85
86 Str_8 GetTitle_8() const override;
87
88 void SetPos(const Vec2_s32& newPos) override;
89
90 Vec2_s32 GetPos() const override;
91
92 void SetScale(const Vec2_u32& newScale) override;
93
94 Vec2_u32 GetScale() const override;
95
97
98 void SetClipboard(Serializer<UInt_64> data) override;
99
100 void SetCursorImg(const CursorImg img) override;
101 };
102}
Definition: Str.h:29
Definition: Window_W32.h:18
void Hide() override
Str_16 GetTitle_16() const override
void Show() override
wl_registry * registry
Definition: Window_Way.h:15
zxdg_decoration_manager_v1 * decManager
Definition: Window_Way.h:21
void SetTitle_16(const Str_16 &newTitle) override
void SetTitle_32(const Str_32 &newTitle) override
xdg_surface * xdgSurface
Definition: Window_Way.h:19
~Window() override
wl_surface * wlSurface
Definition: Window_Way.h:17
wl_seat * seat
Definition: Window_Way.h:23
void Create_8(const Str_8 &title, const Vec2_s32 &pos, Vec2_u32 scale) override
void Create_32(const Str_32 &title, const Vec2_s32 &pos, Vec2_u32 scale) override
wl_display * display
Definition: Window_Way.h:14
void SetTitle_8(const Str_8 &newTitle) override
xdg_toplevel * xdgToplevel
Definition: Window_Way.h:20
void SetPos(const Vec2_s32 &newPos) override
Vec2_s32 GetPos() const override
Vec2_u32 GetScale() const override
Str_32 GetTitle_32() const override
void SetCursorImg(const CursorImg img) override
xdg_wm_base * xdgShell
Definition: Window_Way.h:18
Serializer< UInt_64 > GetClipboard() override
bool Poll() override
void ShowCursor(bool toggle) override
void Create_16(const Str_16 &title, const Vec2_s32 &pos, Vec2_u32 scale) override
Window(const Window &win)
Window & operator=(const Window &win)
Str_8 GetTitle_8() const override
wl_compositor * compositor
Definition: Window_Way.h:16
Vec2_u32 scale
Definition: Window_Way.h:25
void SetScale(const Vec2_u32 &newScale) override
zxdg_toplevel_decoration_v1 * dec
Definition: Window_Way.h:22
void SetClipboard(Serializer< UInt_64 > data) override
void Close() override
void ConstrainCursor(const bool constrain) override
wl_pointer * pointer
Definition: Window_Way.h:24
Definition: Anchor.h:6
unsigned int UInt_32
Definition: Types.h:49
int Int_32
Definition: Types.h:51
CursorImg
Definition: BaseWindow.h:16