EHS/include/ehs/io/Window_XCB.h

95 lines
2.0 KiB
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
#include "BaseWindow.h"
#include "File.h"
#include <xcb/xcb.h>
#include <xcb/xinput.h>
2023-12-17 15:56:13 -08:00
namespace ehs
2023-12-17 03:29:08 -08:00
{
class Window : public BaseWindow
{
protected:
friend class Input;
xcb_connection_t* server;
xcb_screen_t* screen;
xcb_window_t hdl;
xcb_atom_t masks[2];
UInt_8 extOpCode;
Vector<xcb_generic_event_t*> events;
Serializer<UInt_64> clipboard;
public:
2024-01-14 09:38:57 -08:00
~Window() override;
2023-12-17 03:29:08 -08:00
Window();
2024-01-14 09:38:57 -08: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;
2023-12-17 03:29:08 -08:00
2024-01-14 09:38:57 -08:00
void Create_16(const Str_16& title, const Vec2_s32& pos, Vec2_u32 scale) override;
2023-12-17 03:29:08 -08:00
2024-01-14 09:38:57 -08:00
void Create_8(const Str_8& title, const Vec2_s32& pos, Vec2_u32 scale) override;
2023-12-17 03:29:08 -08:00
void Close() override;
void Show() override;
void Hide() override;
bool Poll() override;
void ShowCursor(bool toggle) override;
2024-01-14 09:38:57 -08:00
void ConstrainCursor(bool constrain) override;
2023-12-17 03:29:08 -08:00
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;
2024-01-14 09:38:57 -08:00
void SetCursorImg(CursorImg img) override;
2023-12-17 03:29:08 -08:00
xcb_connection_t* GetServer();
private:
xcb_generic_event_t* RetrieveEvent();
2024-01-14 09:38:57 -08:00
xcb_atom_t RetrieveAtom(bool create, const Str_8& name) const;
2023-12-17 03:29:08 -08:00
2024-01-14 09:38:57 -08:00
xcb_get_property_reply_t* RetrieveProp(xcb_atom_t prop, xcb_atom_t type) const;
2023-12-17 03:29:08 -08:00
void QueryPrimaryDevices();
2024-01-14 09:38:57 -08:00
Str_8 QueryDeviceName(UInt_16 id);
2023-12-17 03:29:08 -08:00
};
}