aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/protocols/Viewporter.hpp
blob: 3c2a4eefd79a7c8f6829577ff93d5590e898a5e6 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include <memory>
#include <vector>
#include <cstdint>
#include "WaylandProtocol.hpp"
#include "viewporter.hpp"
#include "../helpers/signal/Signal.hpp"

class CWLSurfaceResource;

class CViewportResource {
  public:
    CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceResource> surface_);
    ~CViewportResource();

    bool                   good();
    WP<CWLSurfaceResource> surface;

  private:
    SP<CWpViewport> resource;

    struct {
        CHyprSignalListener surfacePrecommit;
    } listeners;
};

class CViewporterResource {
  public:
    CViewporterResource(SP<CWpViewporter> resource_);

    bool good();

  private:
    SP<CWpViewporter> resource;
};

class CViewporterProtocol : public IWaylandProtocol {
  public:
    CViewporterProtocol(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(CViewporterResource* resource);
    void destroyResource(CViewportResource* resource);

    //
    std::vector<SP<CViewporterResource>> m_vManagers;
    std::vector<SP<CViewportResource>>   m_vViewports;

    friend class CViewporterResource;
    friend class CViewportResource;
};

namespace PROTO {
    inline UP<CViewporterProtocol> viewport;
};