blob: 1bb9cf23b53d9c216dda89f8944817e59946d04f (
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
|
#pragma once
#include <memory>
#include <vector>
#include <unordered_map>
#include "WaylandProtocol.hpp"
#include "alpha-modifier-v1.hpp"
#include "../helpers/signal/Signal.hpp"
class CWLSurfaceResource;
class CAlphaModifier {
public:
CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, SP<CWLSurfaceResource> surface);
~CAlphaModifier();
bool good();
SP<CWLSurfaceResource> getSurface();
void onSurfaceDestroy();
private:
SP<CWpAlphaModifierSurfaceV1> resource;
WP<CWLSurfaceResource> pSurface;
void setSurfaceAlpha(float a);
struct {
CHyprSignalListener destroySurface;
} listeners;
};
class CAlphaModifierProtocol : public IWaylandProtocol {
public:
CAlphaModifierProtocol(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 onManagerResourceDestroy(wl_resource* res);
void destroyModifier(CAlphaModifier* decoration);
void onGetSurface(CWpAlphaModifierV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface);
//
std::vector<UP<CWpAlphaModifierV1>> m_vManagers;
std::unordered_map<WP<CWLSurfaceResource>, UP<CAlphaModifier>> m_mAlphaModifiers; // xdg_toplevel -> deco
friend class CAlphaModifier;
};
namespace PROTO {
inline UP<CAlphaModifierProtocol> alphaModifier;
};
|