diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2024-06-08 10:07:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-08 10:07:59 +0200 |
| commit | 6967a31450441fc5605c05db6f65505dace4b263 (patch) | |
| tree | 255a3cff7f3e2eb8a50c952eab9b270a7937561d /src/protocols/core/Output.hpp | |
| parent | c31d9ef4172452f6f219f91d9b87a24d91f0cf3a (diff) | |
wayland/core: move to new impl (#6268)
* wayland/core/dmabuf: move to new impl
it's the final countdown
Diffstat (limited to 'src/protocols/core/Output.hpp')
| -rw-r--r-- | src/protocols/core/Output.hpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/protocols/core/Output.hpp b/src/protocols/core/Output.hpp new file mode 100644 index 00000000..5c274612 --- /dev/null +++ b/src/protocols/core/Output.hpp @@ -0,0 +1,61 @@ +#pragma once + +#include <memory> +#include <vector> +#include <cstdint> +#include "../WaylandProtocol.hpp" +#include "wayland.hpp" +#include "../../helpers/signal/Listener.hpp" + +class CMonitor; + +class CWLOutputResource { + public: + CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMonitor); + static SP<CWLOutputResource> fromResource(wl_resource*); + + bool good(); + wl_client* client(); + SP<CWlOutput> getResource(); + void updateState(); + + WP<CMonitor> monitor; + + WP<CWLOutputResource> self; + + private: + SP<CWlOutput> resource; + wl_client* pClient = nullptr; +}; + +class CWLOutputProtocol : public IWaylandProtocol { + public: + CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, SP<CMonitor> pMonitor); + + virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); + + SP<CWLOutputResource> outputResourceFrom(wl_client* client); + + WP<CMonitor> monitor; + + // will mark the protocol for removal, will be removed when no. of bound outputs is 0 (or when overwritten by a new global) + void remove(); + + private: + void destroyResource(CWLOutputResource* resource); + + // + std::vector<SP<CWLOutputResource>> m_vOutputs; + bool defunct = false; + std::string szName = ""; + + struct { + CHyprSignalListener modeChanged; + } listeners; + + friend class CWLOutputResource; +}; + +namespace PROTO { + inline std::unordered_map<std::string, UP<CWLOutputProtocol>> outputs; +}; |
