EHS/include/io/Window_XCB.h

85 lines
1.9 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:
Window();
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 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;
xcb_connection_t* GetServer();
private:
xcb_generic_event_t* RetrieveEvent();
xcb_atom_t RetrieveAtom(const bool create, const Str_8& name) const;
xcb_get_property_reply_t* RetrieveProp(const xcb_atom_t prop, const xcb_atom_t type) const;
void QueryPrimaryDevices();
Str_8 QueryDeviceName(const UInt_16 id);
};
}