From 407453166ce2a52433c7b0b4ee92a41e47ef8f6d Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Sun, 19 Jan 2025 18:21:36 +0000 Subject: protocols: add hyprland_lock_notify_v1 implementation (#9092) --- src/protocols/LockNotify.hpp | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/protocols/LockNotify.hpp (limited to 'src/protocols/LockNotify.hpp') diff --git a/src/protocols/LockNotify.hpp b/src/protocols/LockNotify.hpp new file mode 100644 index 00000000..ec71034b --- /dev/null +++ b/src/protocols/LockNotify.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include +#include "WaylandProtocol.hpp" +#include "hyprland-lock-notify-v1.hpp" + +class CEventLoopTimer; + +class CHyprlandLockNotification { + public: + CHyprlandLockNotification(SP resource_); + ~CHyprlandLockNotification() = default; + + bool good(); + void onLocked(); + void onUnlocked(); + + private: + SP m_resource; + bool m_locked = false; +}; + +class CLockNotifyProtocol : public IWaylandProtocol { + public: + CLockNotifyProtocol(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); + + void onLocked(); + void onUnlocked(); + + private: + void onManagerResourceDestroy(wl_resource* res); + void destroyNotification(CHyprlandLockNotification* notif); + void onGetNotification(CHyprlandLockNotifierV1* pMgr, uint32_t id); + + bool m_isLocked = false; + + // + std::vector> m_managers; + std::vector> m_notifications; + + friend class CHyprlandLockNotification; +}; + +namespace PROTO { + inline UP lockNotify; +}; -- cgit v1.2.3