aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/protocols/CTMControl.hpp
blob: 70bc79bccf2cb3903cf0920de58c5e553e1a1972 (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
#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(PHLMONITOR monitor, const Mat3x3& ctm);

    //
    std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;

    friend class CHyprlandCTMControlResource;
};

namespace PROTO {
    inline UP<CHyprlandCTMControlProtocol> ctm;
};