#pragma once #include "../../defines.hpp" #include #include "WLSurface.hpp" #include "View.hpp" class CWLSubsurfaceResource; namespace Desktop::View { class CPopup; class CSubsurface : public IView { public: // root dummy nodes static SP create(PHLWINDOW pOwner); static SP create(WP pOwner); // real nodes static SP create(SP pSubsurface, PHLWINDOW pOwner); static SP create(SP pSubsurface, WP pOwner); static SP fromView(SP); virtual ~CSubsurface() = default; virtual eViewType type() const; virtual bool visible() const; virtual std::optional logicalBox() const; virtual bool desktopComponent() const; virtual std::optional surfaceLogicalBox() const; Vector2D coordsRelativeToParent() const; Vector2D coordsGlobal() const; Vector2D size(); void onCommit(); void onDestroy(); void onNewSubsurface(SP pSubsurface); void onMap(); void onUnmap(); void recheckDamageForSubsurfaces(); WP m_self; private: CSubsurface(); struct { CHyprSignalListener destroySubsurface; CHyprSignalListener commitSubsurface; CHyprSignalListener mapSubsurface; CHyprSignalListener unmapSubsurface; CHyprSignalListener newSubsurface; } m_listeners; WP m_subsurface; 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(); }; }