diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-04-29 01:28:26 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-04-29 01:38:24 +0100 |
| commit | 33e0bb14786dc22a0c82eaaf097b469d3fdeceea (patch) | |
| tree | 0b4525880560950eeea48c6279ed41fa3dde0d67 /src/protocols/OutputPower.hpp | |
| parent | a5a648091760ac002120fab18247e5292b6482de (diff) | |
wlr-output-power: move to new impl
Diffstat (limited to 'src/protocols/OutputPower.hpp')
| -rw-r--r-- | src/protocols/OutputPower.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
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 <memory> +#include <vector> +#include <cstdint> +#include "WaylandProtocol.hpp" +#include "wlr-output-power-management-unstable-v1.hpp" +#include "../helpers/signal/Listener.hpp" + +class CMonitor; + +class COutputPower { + public: + COutputPower(SP<CZwlrOutputPowerV1> resource_, CMonitor* pMonitor); + + bool good(); + + private: + SP<CZwlrOutputPowerV1> 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<UP<CZwlrOutputPowerManagerV1>> m_vManagers; + std::vector<UP<COutputPower>> m_vOutputPowers; + + friend class COutputPower; +}; + +namespace PROTO { + inline UP<COutputPowerProtocol> outputPower; +};
\ No newline at end of file |
