summaryrefslogtreecommitdiff
path: root/src/protocols/CTMControl.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-10-08 16:59:15 +0100
committerGitHub <noreply@github.com>2024-10-08 16:59:15 +0100
commit1bf63dfdcd76c09137b4647f9af2c5ebc9fc6e34 (patch)
treee423ee76ef6d27a1178349d3c45737ad4191808d /src/protocols/CTMControl.hpp
parente0cfbec66b97edb2957508152f32e77a1b181afc (diff)
protocols: Add support for hyprland-ctm-control-v1 (#8023)
* initial ctm support * flake.lock: update * Meson: bump required versions and add ctm proto --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src/protocols/CTMControl.hpp')
-rw-r--r--src/protocols/CTMControl.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/protocols/CTMControl.hpp b/src/protocols/CTMControl.hpp
new file mode 100644
index 00000000..08f1b0e8
--- /dev/null
+++ b/src/protocols/CTMControl.hpp
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <memory>
+#include <vector>
+#include <cstdint>
+#include "WaylandProtocol.hpp"
+#include "hyprland-ctm-control-v1.hpp"
+#include <unordered_map>
+
+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(SP<CMonitor> monitor, const Mat3x3& ctm);
+
+ //
+ std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
+
+ friend class CHyprlandCTMControlResource;
+};
+
+namespace PROTO {
+ inline UP<CHyprlandCTMControlProtocol> ctm;
+}; \ No newline at end of file