#pragma once #include #include #include #include "WaylandProtocol.hpp" #include "hyprland-surface-v1.hpp" #include "../helpers/signal/Signal.hpp" class CWLSurfaceResource; class CHyprlandSurfaceProtocol; class CHyprlandSurface { public: CHyprlandSurface(SP resource, SP surface); bool good() const; void setResource(SP resource); private: SP m_resource; WP m_surface; float m_opacity = 1.0; bool m_visibleRegionChanged = false; CRegion m_visibleRegion; void destroy(); struct { CHyprSignalListener surfaceCommitted; CHyprSignalListener surfaceDestroyed; } m_listeners; friend class CHyprlandSurfaceProtocol; }; class CHyprlandSurfaceProtocol : public IWaylandProtocol { public: CHyprlandSurfaceProtocol(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 destroyManager(CHyprlandSurfaceManagerV1* res); void destroySurface(CHyprlandSurface* surface); void getSurface(CHyprlandSurfaceManagerV1* manager, uint32_t id, SP surface); std::vector> m_managers; std::unordered_map, UP> m_surfaces; friend class CHyprlandSurface; }; namespace PROTO { inline UP hyprlandSurface; }