From 4954dcbbb352a72d41b43a6ab107388c17a0b21b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 21 Apr 2024 19:30:23 +0100 Subject: relative-pointer: move to new impl --- src/protocols/RelativePointer.hpp | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/protocols/RelativePointer.hpp (limited to 'src/protocols/RelativePointer.hpp') diff --git a/src/protocols/RelativePointer.hpp b/src/protocols/RelativePointer.hpp new file mode 100644 index 00000000..93446e85 --- /dev/null +++ b/src/protocols/RelativePointer.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include "WaylandProtocol.hpp" +#include "relative-pointer-unstable-v1.hpp" +#include "../helpers/Vector2D.hpp" + +class CRelativePointer { + public: + CRelativePointer(SP resource_); + + void sendRelativeMotion(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel); + + bool good(); + wl_client* client(); + + private: + SP resource; + wl_client* pClient = nullptr; +}; + +class CRelativePointerProtocol : public IWaylandProtocol { + public: + CRelativePointerProtocol(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 sendRelativeMotion(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel); + + private: + void onManagerResourceDestroy(wl_resource* res); + void destroyRelativePointer(CRelativePointer* pointer); + void onGetRelativePointer(CZwpRelativePointerManagerV1* pMgr, uint32_t id, wl_resource* pointer); + + // + std::vector> m_vManagers; + std::vector> m_vRelativePointers; + + friend class CRelativePointer; +}; + +namespace PROTO { + inline UP relativePointer; +}; \ No newline at end of file -- cgit v1.2.3