2024-02-29 01:03:28 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include <vector>
|
|
|
|
#include "WLSurface.hpp"
|
|
|
|
|
2024-02-29 15:26:02 +01:00
|
|
|
class CPopup;
|
2024-06-08 10:07:59 +02:00
|
|
|
class CWLSubsurfaceResource;
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
class CSubsurface {
|
|
|
|
public:
|
|
|
|
// root dummy nodes
|
2024-04-27 13:43:12 +02:00
|
|
|
CSubsurface(PHLWINDOW pOwner);
|
2024-02-29 15:26:02 +01:00
|
|
|
CSubsurface(CPopup* pOwner);
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
// real nodes
|
2024-06-08 10:07:59 +02:00
|
|
|
CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner);
|
|
|
|
CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, CPopup* pOwner);
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
~CSubsurface();
|
|
|
|
|
|
|
|
Vector2D coordsRelativeToParent();
|
|
|
|
Vector2D coordsGlobal();
|
|
|
|
|
2024-02-29 16:07:11 +01:00
|
|
|
Vector2D size();
|
|
|
|
|
2024-02-29 01:03:28 +01:00
|
|
|
void onCommit();
|
|
|
|
void onDestroy();
|
2024-06-08 10:07:59 +02:00
|
|
|
void onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface);
|
2024-02-29 01:03:28 +01:00
|
|
|
void onMap();
|
|
|
|
void onUnmap();
|
|
|
|
|
2024-05-05 00:46:10 +02:00
|
|
|
bool visible();
|
|
|
|
|
2024-02-29 01:03:28 +01:00
|
|
|
void recheckDamageForSubsurfaces();
|
|
|
|
|
|
|
|
private:
|
2024-06-08 10:07:59 +02:00
|
|
|
struct {
|
|
|
|
CHyprSignalListener destroySubsurface;
|
|
|
|
CHyprSignalListener commitSubsurface;
|
|
|
|
CHyprSignalListener mapSubsurface;
|
|
|
|
CHyprSignalListener unmapSubsurface;
|
|
|
|
CHyprSignalListener newSubsurface;
|
|
|
|
} listeners;
|
|
|
|
|
|
|
|
WP<CWLSubsurfaceResource> m_pSubsurface;
|
|
|
|
SP<CWLSurface> m_pWLSurface;
|
|
|
|
Vector2D m_vLastSize = {};
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
// if nullptr, means it's a dummy node
|
|
|
|
CSubsurface* m_pParent = nullptr;
|
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOWREF m_pWindowParent;
|
|
|
|
CPopup* m_pPopupParent = nullptr;
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
std::vector<std::unique_ptr<CSubsurface>> m_vChildren;
|
|
|
|
|
2024-02-29 15:26:02 +01:00
|
|
|
bool m_bInert = false;
|
|
|
|
|
2024-02-29 01:03:28 +01:00
|
|
|
void initSignals();
|
2024-06-08 10:07:59 +02:00
|
|
|
void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
|
2024-02-29 01:03:28 +01:00
|
|
|
void checkSiblingDamage();
|
|
|
|
};
|