EHS/include/ehs/io/Window_Way.h

102 lines
2.5 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
{
2024-07-24 01:36:20 -07:00
class EHS_LIB_IO Window : public BaseWindow
2024-02-05 22:25:30 -08:00
{
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
zxdg_decoration_manager_v1 *decManager;
zxdg_toplevel_decoration_v1 *dec;
wl_seat *seat;
wl_pointer *pointer;
Vec2_u32 scale;
2024-07-03 19:49:18 -07:00
static void SurfaceConfigEvent(void *data, xdg_surface *xdg_surface, UInt_32 serial);
2024-02-05 22:25:30 -08:00
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);
static void ResizeEvent(void *data, xdg_toplevel *xdg_toplevel, Int_32 width, Int_32 height, wl_array *states);
static void CloseEvent(void *data, xdg_toplevel *xdg_toplevel);
static void SeatCapabilitiesEvent(void *data, wl_seat *seat, UInt_32 capabilities);
static void PointerMotionEvent(void *data, wl_pointer *pointer, UInt_32 time, wl_fixed_t sx, wl_fixed_t sy);
2024-07-03 19:49:18 -07:00
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);
void Create_32(const Str_32& title, const Vec2_s32& pos, Vec2_u32 scale) override;
2024-02-05 22:25:30 -08:00
void Create_16(const Str_16& title, const Vec2_s32& pos, Vec2_u32 scale) override;
2024-02-05 22:25:30 -08:00
void Create_8(const Str_8& title, const Vec2_s32& pos, Vec2_u32 scale) override;
2024-02-05 22:25:30 -08:00
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;
};
}