From 33e0bb14786dc22a0c82eaaf097b469d3fdeceea Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 29 Apr 2024 01:28:26 +0100 Subject: wlr-output-power: move to new impl --- src/protocols/OutputPower.hpp | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/protocols/OutputPower.hpp (limited to 'src/protocols/OutputPower.hpp') diff --git a/src/protocols/OutputPower.hpp b/src/protocols/OutputPower.hpp new file mode 100644 index 00000000..44788a8f --- /dev/null +++ b/src/protocols/OutputPower.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include +#include "WaylandProtocol.hpp" +#include "wlr-output-power-management-unstable-v1.hpp" +#include "../helpers/signal/Listener.hpp" + +class CMonitor; + +class COutputPower { + public: + COutputPower(SP resource_, CMonitor* pMonitor); + + bool good(); + + private: + SP resource; + + CMonitor* pMonitor = nullptr; + + struct { + CHyprSignalListener monitorDestroy; + CHyprSignalListener monitorState; + CHyprSignalListener monitorDpms; + } listeners; +}; + +class COutputPowerProtocol : public IWaylandProtocol { + public: + COutputPowerProtocol(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 onManagerResourceDestroy(wl_resource* res); + void destroyOutputPower(COutputPower* pointer); + void onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uint32_t id, wl_resource* output); + + // + std::vector> m_vManagers; + std::vector> m_vOutputPowers; + + friend class COutputPower; +}; + +namespace PROTO { + inline UP outputPower; +}; \ No newline at end of file -- cgit v1.2.3