EHS/include/ehs/io/Window_Way.h

99 lines
2.3 KiB
C
Raw Normal View History

2024-02-05 22:25:30 -08:00
#pragma once
#include "BaseWindow.h"
#include <wayland-client.h>
#include "xdg-shell-client-protocol.h"
2024-07-03 19:49:18 -07:00
#include "xdg-decoration.h"
2024-02-05 22:25:30 -08:00
namespace ehs
{
class Window : public BaseWindow
{
2024-07-03 19:49:18 -07:00
protected:
wl_display *display;
2024-02-05 22:25:30 -08:00
wl_registry *registry;
2024-07-03 19:49:18 -07:00
wl_compositor *compositor;
wl_surface *wlSurface;
2024-02-05 22:25:30 -08:00
xdg_wm_base *xdgShell;
xdg_surface *xdgSurface;
xdg_toplevel *xdgToplevel;
2024-07-03 19:49:18 -07:00
wl_shm *shm;
wl_buffer *buffer;
zxdg_decoration_manager_v1 *decManager;
zxdg_toplevel_decoration_v1 *dec;
static Int_32 CreateShmFile(Size size);
void CreateBuffer(Vec2_u32 scale);
2024-02-05 22:25:30 -08:00
static void SurfaceConfigure(void *data, xdg_surface *xdg_surface, UInt_32 serial);
static void ShellPing(void *data, xdg_wm_base *shell, UInt_32 serial);
static void RegistryHandler(void *data, wl_registry *registry, UInt_32 id, const char *interface, UInt_32 version);
static void RegistryRemoved(void *data, wl_registry *registry, UInt_32 id);
2024-07-03 19:49:18 -07:00
static void Resolution(void *data, struct xdg_toplevel *xdg_toplevel, Int_32 width, Int_32 height, wl_array *states);
2024-02-05 22:25:30 -08:00
public:
~Window() override;
Window();
2024-07-03 19:49:18 -07:00
Window(Window &&win) noexcept;
Window(const Window &win);
Window &operator=(Window &&win) noexcept;
Window &operator=(const Window &win);
2024-02-05 22:25:30 -08:00
void Create_32(const Str_32& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void Create_16(const Str_16& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void Create_8(const Str_8& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void OnCreated() override;
void Close() override;
void Show() override;
void Hide() override;
bool Poll() override;
void ShowCursor(bool toggle) override;
void ConstrainCursor(const bool constrain) override;
void SetTitle_32(const Str_32& newTitle) override;
Str_32 GetTitle_32() const override;
void SetTitle_16(const Str_16& newTitle) override;
Str_16 GetTitle_16() const override;
void SetTitle_8(const Str_8& newTitle) override;
Str_8 GetTitle_8() const override;
void SetPos(const Vec2_s32& newPos) override;
Vec2_s32 GetPos() const override;
void SetScale(const Vec2_u32& newScale) override;
Vec2_u32 GetScale() const override;
Serializer<UInt_64> GetClipboard() override;
void SetClipboard(Serializer<UInt_64> data) override;
void SetCursorImg(const CursorImg img) override;
};
}