#pragma once #include #include #include "WaylandProtocol.hpp" #include "idle-inhibit-unstable-v1.hpp" #include "../helpers/signal/Signal.hpp" class CIdleInhibitorResource; class CWLSurfaceResource; class CIdleInhibitor { public: CIdleInhibitor(SP resource_, SP surf_); struct { CHyprSignalListener destroy; } listeners; WP resource; WP surface; }; class CIdleInhibitorResource { public: CIdleInhibitorResource(SP resource_, SP surface_); ~CIdleInhibitorResource(); SP inhibitor; struct { CSignal destroy; } events; private: SP resource; WP surface; bool destroySent = false; struct { CHyprSignalListener destroySurface; } listeners; }; class CIdleInhibitProtocol : public IWaylandProtocol { public: CIdleInhibitProtocol(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); struct { CSignal newIdleInhibitor; // data: SP } events; private: void onManagerResourceDestroy(wl_resource* res); void onCreateInhibitor(CZwpIdleInhibitManagerV1* pMgr, uint32_t id, SP surface); void removeInhibitor(CIdleInhibitorResource*); // std::vector> m_vManagers; std::vector> m_vInhibitors; friend class CIdleInhibitorResource; }; namespace PROTO { inline UP idleInhibit; }