2024-10-08 16:59:15 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
|
#include "hyprland-ctm-control-v1.hpp"
|
|
|
|
|
#include <unordered_map>
|
2024-12-29 19:21:20 +01:00
|
|
|
#include <map>
|
|
|
|
|
#include "../helpers/AnimatedVariable.hpp"
|
2024-10-08 16:59:15 +01:00
|
|
|
|
|
|
|
|
class CMonitor;
|
|
|
|
|
|
|
|
|
|
class CHyprlandCTMControlResource {
|
|
|
|
|
public:
|
|
|
|
|
CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_);
|
|
|
|
|
~CHyprlandCTMControlResource();
|
|
|
|
|
|
|
|
|
|
bool good();
|
2025-02-02 09:31:04 -08:00
|
|
|
void block();
|
2024-10-08 16:59:15 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
SP<CHyprlandCtmControlManagerV1> resource;
|
|
|
|
|
|
|
|
|
|
std::unordered_map<std::string, Mat3x3> ctms;
|
2025-02-02 09:31:04 -08:00
|
|
|
bool blocked = false;
|
2024-10-08 16:59:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
|
|
|
|
public:
|
|
|
|
|
CHyprlandCTMControlProtocol(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(CHyprlandCTMControlResource* resource);
|
|
|
|
|
|
2024-10-26 02:06:13 +01:00
|
|
|
void setCTM(PHLMONITOR monitor, const Mat3x3& ctm);
|
2024-12-30 11:57:55 +01:00
|
|
|
bool isCTMAnimationEnabled();
|
2024-10-08 16:59:15 +01:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
|
2025-02-02 09:31:04 -08:00
|
|
|
WP<CHyprlandCTMControlResource> m_pManager;
|
2024-10-08 16:59:15 +01:00
|
|
|
|
2024-12-29 19:21:20 +01:00
|
|
|
//
|
|
|
|
|
struct SCTMData {
|
|
|
|
|
SCTMData();
|
2025-01-07 17:55:14 +00:00
|
|
|
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
|
|
|
|
|
PHLANIMVAR<float> progress;
|
2024-12-29 19:21:20 +01:00
|
|
|
};
|
2025-01-23 21:55:41 +01:00
|
|
|
std::map<PHLMONITORREF, UP<SCTMData>> m_mCTMDatas;
|
2024-12-29 19:21:20 +01:00
|
|
|
|
2024-10-08 16:59:15 +01:00
|
|
|
friend class CHyprlandCTMControlResource;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
|
inline UP<CHyprlandCTMControlProtocol> ctm;
|
2025-02-02 09:31:04 -08:00
|
|
|
};
|