#pragma once #include "../defines.hpp" #include #include "WLSurface.hpp" class CPopup; class CWLSubsurfaceResource; class CSubsurface { public: // root dummy nodes static UP create(PHLWINDOW pOwner); static UP create(WP pOwner); // real nodes static UP create(SP pSubsurface, PHLWINDOW pOwner); static UP create(SP pSubsurface, WP pOwner); ~CSubsurface() = default; Vector2D coordsRelativeToParent(); Vector2D coordsGlobal(); Vector2D size(); void onCommit(); void onDestroy(); void onNewSubsurface(SP pSubsurface); void onMap(); void onUnmap(); bool visible(); void recheckDamageForSubsurfaces(); WP m_self; private: CSubsurface() = default; struct { CHyprSignalListener destroySubsurface; CHyprSignalListener commitSubsurface; CHyprSignalListener mapSubsurface; CHyprSignalListener unmapSubsurface; CHyprSignalListener newSubsurface; } m_listeners; WP m_subsurface; SP m_wlSurface; Vector2D m_lastSize = {}; Vector2D m_lastPosition = {}; // if nullptr, means it's a dummy node WP m_parent; PHLWINDOWREF m_windowParent; WP m_popupParent; std::vector> m_children; bool m_inert = false; void initSignals(); void initExistingSubsurfaces(SP pSurface); void checkSiblingDamage(); void damageLastArea(); };