#pragma once #include #include #include #include "WaylandProtocol.hpp" #include "xwayland-shell-v1.hpp" #include "../helpers/signal/Signal.hpp" class CXWaylandSurfaceResource { public: CXWaylandSurfaceResource(SP resource_, wlr_surface* surface_); ~CXWaylandSurfaceResource(); bool good(); wl_client* client(); struct { CSignal destroy; } events; uint64_t serial = 0; wlr_surface* surface = nullptr; WP self; private: SP resource; wl_client* pClient = nullptr; }; class CXWaylandShellResource { public: CXWaylandShellResource(SP resource_); bool good(); private: SP resource; }; class CXWaylandShellProtocol : public IWaylandProtocol { public: CXWaylandShellProtocol(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 newSurface; // SP. Fired when it sets a serial, otherwise it's useless } events; private: void destroyResource(CXWaylandSurfaceResource* resource); void destroyResource(CXWaylandShellResource* resource); // std::vector> m_vManagers; std::vector> m_vSurfaces; friend class CXWaylandSurfaceResource; friend class CXWaylandShellResource; }; namespace PROTO { inline UP xwaylandShell; };