hyprland/src/protocols/CTMControl.hpp
Maximilian Seidler 5642ed331d
core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation

* config: move animation config to hyprutils animation tree

* use g_pAnimationManager->createAnimation and the new PHLANIMVAR template

* core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks

* core: adapt animated variable usage (dereference the shared pointer)

* misc: bump CMakeLists to hyprutils 0.3.3
2025-01-07 17:55:14 +00:00

55 lines
1.4 KiB
C++

#pragma once
#include <memory>
#include <vector>
#include <cstdint>
#include "WaylandProtocol.hpp"
#include "hyprland-ctm-control-v1.hpp"
#include <unordered_map>
#include <map>
#include "../helpers/AnimatedVariable.hpp"
class CMonitor;
class CHyprlandCTMControlResource {
public:
CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_);
~CHyprlandCTMControlResource();
bool good();
private:
SP<CHyprlandCtmControlManagerV1> resource;
std::unordered_map<std::string, Mat3x3> ctms;
};
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);
void setCTM(PHLMONITOR monitor, const Mat3x3& ctm);
bool isCTMAnimationEnabled();
//
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
//
struct SCTMData {
SCTMData();
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
PHLANIMVAR<float> progress;
};
std::map<PHLMONITORREF, std::unique_ptr<SCTMData>> m_mCTMDatas;
friend class CHyprlandCTMControlResource;
};
namespace PROTO {
inline UP<CHyprlandCTMControlProtocol> ctm;
};