mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 23:21:57 -07:00
protocols: add hyprland_lock_notify_v1 implementation (#9092)
This commit is contained in:
committed by
GitHub
parent
8dd2cd41fb
commit
407453166c
50
src/protocols/LockNotify.hpp
Normal file
50
src/protocols/LockNotify.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "WaylandProtocol.hpp"
|
||||
#include "hyprland-lock-notify-v1.hpp"
|
||||
|
||||
class CEventLoopTimer;
|
||||
|
||||
class CHyprlandLockNotification {
|
||||
public:
|
||||
CHyprlandLockNotification(SP<CHyprlandLockNotificationV1> resource_);
|
||||
~CHyprlandLockNotification() = default;
|
||||
|
||||
bool good();
|
||||
void onLocked();
|
||||
void onUnlocked();
|
||||
|
||||
private:
|
||||
SP<CHyprlandLockNotificationV1> 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<UP<CHyprlandLockNotifierV1>> m_managers;
|
||||
std::vector<SP<CHyprlandLockNotification>> m_notifications;
|
||||
|
||||
friend class CHyprlandLockNotification;
|
||||
};
|
||||
|
||||
namespace PROTO {
|
||||
inline UP<CLockNotifyProtocol> lockNotify;
|
||||
};
|
Reference in New Issue
Block a user