summaryrefslogtreecommitdiff
path: root/src/protocols/LockNotify.hpp
diff options
context:
space:
mode:
authorMaximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com>2025-01-19 18:21:36 +0000
committerGitHub <noreply@github.com>2025-01-19 18:21:36 +0000
commit407453166ce2a52433c7b0b4ee92a41e47ef8f6d (patch)
tree441ec15b12061dd89ebf3bffb53b28daf514f547 /src/protocols/LockNotify.hpp
parent8dd2cd41fb4c5a5eb6886cc190419b36084cabfa (diff)
protocols: add hyprland_lock_notify_v1 implementation (#9092)
Diffstat (limited to 'src/protocols/LockNotify.hpp')
-rw-r--r--src/protocols/LockNotify.hpp50
1 files changed, 50 insertions, 0 deletions
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 <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;
+};