blob: 6c46c2e658c69149f0964910551e5aaaa8670a5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#pragma once
/*
Implementations for:
- wl_subsurface
- wl_subcompositor
*/
#include <vector>
#include <cstdint>
#include "../WaylandProtocol.hpp"
#include "wayland.hpp"
#include "../../helpers/signal/Signal.hpp"
#include "../types/SurfaceRole.hpp"
class CWLSurfaceResource;
class CWLSubsurfaceResource;
class CSubsurfaceRole : public ISurfaceRole {
public:
CSubsurfaceRole(SP<CWLSubsurfaceResource> sub);
virtual eSurfaceRole role() {
return SURFACE_ROLE_SUBSURFACE;
}
WP<CWLSubsurfaceResource> m_subsurface;
};
class CWLSubsurfaceResource {
public:
CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWLSurfaceResource> surface_, SP<CWLSurfaceResource> parent_);
~CWLSubsurfaceResource();
Vector2D posRelativeToParent();
bool good();
SP<CWLSurfaceResource> t1Parent();
bool m_sync = false;
Vector2D m_position;
WP<CWLSurfaceResource> m_surface;
WP<CWLSurfaceResource> m_parent;
WP<CWLSubsurfaceResource> m_self;
int m_zIndex = 1; // by default, it's above
struct {
CSignalT<> destroy;
} m_events;
private:
SP<CWlSubsurface> m_resource;
void destroy();
void unlinkFromParent();
struct {
CHyprSignalListener commitSurface;
} m_listeners;
};
class CWLSubcompositorResource {
public:
CWLSubcompositorResource(SP<CWlSubcompositor> resource_);
bool good();
private:
SP<CWlSubcompositor> m_resource;
};
class CWLSubcompositorProtocol : public IWaylandProtocol {
public:
CWLSubcompositorProtocol(const wl_interface* iface, const int& ver, const std::string& name);
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
private:
void destroyResource(CWLSubcompositorResource* resource);
void destroyResource(CWLSubsurfaceResource* resource);
//
std::vector<SP<CWLSubcompositorResource>> m_managers;
std::vector<SP<CWLSubsurfaceResource>> m_surfaces;
friend class CWLSubcompositorResource;
friend class CWLSubsurfaceResource;
};
namespace PROTO {
inline UP<CWLSubcompositorProtocol> subcompositor;
};
|