From 30e4b404f2a30230f57c946b655c2365b3bf8e3d Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 21 Apr 2024 01:47:38 +0100 Subject: cursor-shape: move to new impl --- src/protocols/CursorShape.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/protocols/CursorShape.hpp (limited to 'src/protocols/CursorShape.hpp') diff --git a/src/protocols/CursorShape.hpp b/src/protocols/CursorShape.hpp new file mode 100644 index 00000000..f410bf5b --- /dev/null +++ b/src/protocols/CursorShape.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include "WaylandProtocol.hpp" +#include "../helpers/signal/Signal.hpp" +#include "cursor-shape-v1.hpp" + +class CCursorShapeProtocol : public IWaylandProtocol { + public: + CCursorShapeProtocol(const wl_interface* iface, const int& ver, const std::string& name); + + virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); + + void onManagerResourceDestroy(wl_resource* res); + void onDeviceResourceDestroy(wl_resource* res); + + void onGetPointer(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* pointer); + void onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* tablet); + + void onSetShape(CWpCursorShapeDeviceV1* pMgr, uint32_t serial, wpCursorShapeDeviceV1Shape shape); + + struct SSetShapeEvent { + CWpCursorShapeDeviceV1* pMgr = nullptr; + wpCursorShapeDeviceV1Shape shape; + std::string shapeName; + }; + + struct { + CSignal setShape; + } events; + + private: + void createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource); + + std::unordered_map> m_mDevices; + std::vector> m_vManagers; +}; + +namespace PROTO { + inline UP cursorShape; +}; \ No newline at end of file -- cgit v1.2.3