2024-02-29 01:03:28 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include <vector>
|
|
|
|
#include "WLSurface.hpp"
|
|
|
|
|
|
|
|
class CWindow;
|
2024-02-29 15:26:02 +01:00
|
|
|
class CPopup;
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
class CSubsurface {
|
|
|
|
public:
|
|
|
|
// root dummy nodes
|
|
|
|
CSubsurface(CWindow* pOwner);
|
2024-02-29 15:26:02 +01:00
|
|
|
CSubsurface(CPopup* pOwner);
|
2024-02-29 01:03:28 +01:00
|
|
|
|
|
|
|
// real nodes
|
|
|
|
CSubsurface(wlr_subsurface* pSubsurface, CWindow* pOwner);
|
2024-02-29 15:26:02 +01:00
|
|
|
CSubsurface(wlr_subsurface* 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();
|
|
|
|
void onNewSubsurface(wlr_subsurface* pSubsurface);
|
|
|
|
void onMap();
|
|
|
|
void onUnmap();
|
|
|
|
|
|
|
|
void recheckDamageForSubsurfaces();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DYNLISTENER(destroySubsurface);
|
|
|
|
DYNLISTENER(commitSubsurface);
|
|
|
|
DYNLISTENER(newSubsurface);
|
|
|
|
DYNLISTENER(mapSubsurface);
|
|
|
|
DYNLISTENER(unmapSubsurface);
|
|
|
|
|
|
|
|
wlr_subsurface* m_pSubsurface = nullptr;
|
|
|
|
CWLSurface m_sWLSurface;
|
|
|
|
Vector2D m_vLastSize = {};
|
|
|
|
|
|
|
|
// if nullptr, means it's a dummy node
|
|
|
|
CSubsurface* m_pParent = nullptr;
|
|
|
|
|
|
|
|
CWindow* m_pWindowParent = nullptr;
|
2024-02-29 15:26:02 +01:00
|
|
|
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-04-06 04:09:20 +02:00
|
|
|
void initExistingSubsurfaces(wlr_surface* pSurface);
|
2024-02-29 01:03:28 +01:00
|
|
|
void checkSiblingDamage();
|
|
|
|
};
|