Hyprland/src/helpers/SubsurfaceTree.hpp

55 lines
1.3 KiB
C++
Raw Normal View History

2022-03-27 17:25:20 +02:00
#pragma once
#include "../defines.hpp"
#include <list>
struct SSubsurface;
class CWindow;
2022-03-27 17:25:20 +02:00
typedef void (*applyGlobalOffsetFn)(void*, int*, int*);
2022-03-27 17:25:20 +02:00
struct SSurfaceTreeNode {
wlr_surface* pSurface = nullptr;
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
SSurfaceTreeNode* pParent = nullptr;
SSubsurface* pSubsurface = nullptr;
2022-03-27 17:25:20 +02:00
std::list<SSubsurface> childSubsurfaces;
applyGlobalOffsetFn offsetfn;
void* globalOffsetData;
CWindow* pWindowOwner = nullptr;
2022-03-27 17:25:20 +02:00
bool operator==(const SSurfaceTreeNode& rhs) {
2022-03-27 17:25:20 +02:00
return pSurface == rhs.pSurface;
}
};
struct SSubsurface {
wlr_subsurface* pSubsurface = nullptr;
2022-03-27 17:25:20 +02: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
CWindow* pWindowOwner = nullptr;
bool operator==(const SSubsurface& rhs) {
2022-03-27 17:25:20 +02:00
return pSubsurface == rhs.pSubsurface;
}
};
namespace SubsurfaceTree {
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;
};