#pragma once #include #include #include "WaylandProtocol.hpp" #include "linux-drm-syncobj-v1.hpp" #include "../helpers/signal/Signal.hpp" class CWLSurfaceResource; class CDRMSyncobjTimelineResource; class CSyncTimeline; class CDRMSyncobjSurfaceResource { public: CDRMSyncobjSurfaceResource(SP resource_, SP surface_); bool good(); WP surface; WP acquireTimeline, releaseTimeline; uint64_t acquirePoint = 0, releasePoint = 0; private: SP resource; struct { CHyprSignalListener surfacePrecommit; } listeners; }; class CDRMSyncobjTimelineResource { public: CDRMSyncobjTimelineResource(SP resource_, int fd_); static SP fromResource(wl_resource*); bool good(); WP self; int fd = -1; SP timeline; private: SP resource; }; class CDRMSyncobjManagerResource { public: CDRMSyncobjManagerResource(SP resource_); bool good(); private: SP resource; }; class CDRMSyncobjProtocol : public IWaylandProtocol { public: CDRMSyncobjProtocol(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); private: void destroyResource(CDRMSyncobjManagerResource* resource); void destroyResource(CDRMSyncobjTimelineResource* resource); void destroyResource(CDRMSyncobjSurfaceResource* resource); // std::vector> m_vManagers; std::vector> m_vTimelines; std::vector> m_vSurfaces; // int drmFD = -1; friend class CDRMSyncobjManagerResource; friend class CDRMSyncobjTimelineResource; friend class CDRMSyncobjSurfaceResource; }; namespace PROTO { inline UP sync; };