From 6967a31450441fc5605c05db6f65505dace4b263 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 8 Jun 2024 10:07:59 +0200 Subject: wayland/core: move to new impl (#6268) * wayland/core/dmabuf: move to new impl it's the final countdown --- src/protocols/core/Output.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/protocols/core/Output.hpp (limited to 'src/protocols/core/Output.hpp') 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 +#include +#include +#include "../WaylandProtocol.hpp" +#include "wayland.hpp" +#include "../../helpers/signal/Listener.hpp" + +class CMonitor; + +class CWLOutputResource { + public: + CWLOutputResource(SP resource_, SP pMonitor); + static SP fromResource(wl_resource*); + + bool good(); + wl_client* client(); + SP getResource(); + void updateState(); + + WP monitor; + + WP self; + + private: + SP resource; + wl_client* pClient = nullptr; +}; + +class CWLOutputProtocol : public IWaylandProtocol { + public: + CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, SP pMonitor); + + virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); + + SP outputResourceFrom(wl_client* client); + + WP 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> m_vOutputs; + bool defunct = false; + std::string szName = ""; + + struct { + CHyprSignalListener modeChanged; + } listeners; + + friend class CWLOutputResource; +}; + +namespace PROTO { + inline std::unordered_map> outputs; +}; -- cgit v1.2.3