2024-04-21 22:21:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
#include "alpha-modifier-v1.hpp"
|
2024-06-11 17:17:45 +02:00
|
|
|
#include "../helpers/signal/Signal.hpp"
|
2024-06-08 10:07:59 +02:00
|
|
|
|
|
|
|
class CWLSurfaceResource;
|
2024-04-21 22:21:22 +02:00
|
|
|
|
|
|
|
class CAlphaModifier {
|
|
|
|
public:
|
2024-06-08 10:07:59 +02:00
|
|
|
CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, SP<CWLSurfaceResource> surface);
|
2024-04-21 22:21:22 +02:00
|
|
|
~CAlphaModifier();
|
|
|
|
|
2024-06-08 10:07:59 +02:00
|
|
|
bool good();
|
|
|
|
SP<CWLSurfaceResource> getSurface();
|
|
|
|
void onSurfaceDestroy();
|
2024-04-21 22:21:22 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CWpAlphaModifierSurfaceV1> resource;
|
2024-06-08 10:07:59 +02:00
|
|
|
WP<CWLSurfaceResource> pSurface;
|
2024-04-21 22:21:22 +02:00
|
|
|
|
2024-04-21 22:29:37 +02:00
|
|
|
void setSurfaceAlpha(float a);
|
2024-04-21 22:21:22 +02:00
|
|
|
|
2024-06-08 10:07:59 +02:00
|
|
|
struct {
|
|
|
|
CHyprSignalListener destroySurface;
|
|
|
|
} listeners;
|
2024-04-21 22:21:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
2024-06-08 10:07:59 +02:00
|
|
|
void onGetSurface(CWpAlphaModifierV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface);
|
2024-04-21 22:21:22 +02:00
|
|
|
|
|
|
|
//
|
2024-06-08 10:07:59 +02:00
|
|
|
std::vector<UP<CWpAlphaModifierV1>> m_vManagers;
|
|
|
|
std::unordered_map<WP<CWLSurfaceResource>, UP<CAlphaModifier>> m_mAlphaModifiers; // xdg_toplevel -> deco
|
2024-04-21 22:21:22 +02:00
|
|
|
|
|
|
|
friend class CAlphaModifier;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CAlphaModifierProtocol> alphaModifier;
|
2024-06-08 10:07:59 +02:00
|
|
|
};
|