mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 13:41:59 -07:00
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <cstdint>
|
|
#include "WaylandProtocol.hpp"
|
|
#include "wlr-output-power-management-unstable-v1.hpp"
|
|
#include "../helpers/signal/Signal.hpp"
|
|
|
|
class CMonitor;
|
|
|
|
class COutputPower {
|
|
public:
|
|
COutputPower(SP<CZwlrOutputPowerV1> resource_, PHLMONITOR pMonitor);
|
|
|
|
bool good();
|
|
|
|
private:
|
|
SP<CZwlrOutputPowerV1> m_resource;
|
|
|
|
PHLMONITORREF m_monitor;
|
|
|
|
struct {
|
|
CHyprSignalListener monitorDestroy;
|
|
CHyprSignalListener monitorState;
|
|
CHyprSignalListener monitorDpms;
|
|
} m_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_managers;
|
|
std::vector<UP<COutputPower>> m_outputPowers;
|
|
|
|
friend class COutputPower;
|
|
};
|
|
|
|
namespace PROTO {
|
|
inline UP<COutputPowerProtocol> outputPower;
|
|
}; |