2022-03-27 17:25:20 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include <list>
|
2023-03-20 16:00:58 +01:00
|
|
|
#include "WLSurface.hpp"
|
2022-03-27 17:25:20 +02:00
|
|
|
|
|
|
|
struct SSubsurface;
|
2022-05-31 22:16:13 +02:00
|
|
|
class CWindow;
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
typedef void (*applyGlobalOffsetFn)(void*, int*, int*);
|
2022-03-27 17:25:20 +02:00
|
|
|
|
|
|
|
struct SSurfaceTreeNode {
|
2023-03-20 16:00:58 +01:00
|
|
|
CWLSurface* pSurface = nullptr; // actual surface
|
|
|
|
CWLSurface pInternalSurface; // not present for head nodes to not dupe wlr_surface ownership
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-03-28 22:31:39 +02:00
|
|
|
DYNLISTENER(newSubsurface);
|
|
|
|
DYNLISTENER(commit);
|
|
|
|
DYNLISTENER(destroy);
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
SSurfaceTreeNode* pParent = nullptr;
|
|
|
|
SSubsurface* pSubsurface = nullptr;
|
2022-03-27 17:25:20 +02:00
|
|
|
|
|
|
|
std::list<SSubsurface> childSubsurfaces;
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
applyGlobalOffsetFn offsetfn;
|
|
|
|
void* globalOffsetData;
|
|
|
|
CWindow* pWindowOwner = nullptr;
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2023-11-13 00:06:31 +01:00
|
|
|
Vector2D lastSize;
|
|
|
|
|
2023-08-07 13:35:19 +02:00
|
|
|
//
|
|
|
|
bool operator==(const SSurfaceTreeNode& rhs) const {
|
2022-03-27 17:25:20 +02:00
|
|
|
return pSurface == rhs.pSurface;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSubsurface {
|
2022-12-16 18:17:31 +01:00
|
|
|
wlr_subsurface* pSubsurface = nullptr;
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
SSurfaceTreeNode* pParent = nullptr;
|
|
|
|
SSurfaceTreeNode* pChild = nullptr;
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-03-28 22:31:39 +02:00
|
|
|
DYNLISTENER(map);
|
|
|
|
DYNLISTENER(unmap);
|
|
|
|
DYNLISTENER(destroy);
|
2022-03-27 17:25:20 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CWindow* pWindowOwner = nullptr;
|
2022-05-31 22:16:13 +02:00
|
|
|
|
2023-08-07 13:35:19 +02:00
|
|
|
//
|
|
|
|
bool operator==(const SSubsurface& rhs) const {
|
2022-03-27 17:25:20 +02:00
|
|
|
return pSubsurface == rhs.pSubsurface;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace SubsurfaceTree {
|
2022-12-16 18:17:31 +01:00
|
|
|
SSurfaceTreeNode* createTreeRoot(wlr_surface*, applyGlobalOffsetFn, void*, CWindow* pWindow = nullptr);
|
|
|
|
void destroySurfaceTree(SSurfaceTreeNode*);
|
2022-03-27 17:25:20 +02:00
|
|
|
|
|
|
|
inline std::list<SSurfaceTreeNode> surfaceTreeNodes;
|
|
|
|
};
|