summaryrefslogtreecommitdiff
path: root/src/managers/ProtocolManager.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-02-22 23:30:10 +0000
committerGitHub <noreply@github.com>2026-02-22 23:30:10 +0000
commitb88813c7efa4b7b0c5fe01471c5fa5b67a61dc7e (patch)
tree4454e82bc033d7e28a23ee372d0e3f48341d0aaa /src/managers/ProtocolManager.cpp
parentb4ee4674f9a74e3d602c7fb17bc09f79d221583c (diff)
event: refactor HookSystem into a typed event bus (#13333)
Refactors the old HookSystem into a typed event bus with clear separation, discovery and types.
Diffstat (limited to 'src/managers/ProtocolManager.cpp')
-rw-r--r--src/managers/ProtocolManager.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp
index 216c07f1..c13e6e48 100644
--- a/src/managers/ProtocolManager.cpp
+++ b/src/managers/ProtocolManager.cpp
@@ -67,9 +67,9 @@
#include "../protocols/PointerWarp.hpp"
#include "../protocols/Fifo.hpp"
#include "../protocols/CommitTiming.hpp"
-#include "HookSystemManager.hpp"
#include "../helpers/Monitor.hpp"
+#include "../event/EventBus.hpp"
#include "../render/Renderer.hpp"
#include "../Compositor.hpp"
#include "content-type-v1.hpp"
@@ -113,9 +113,7 @@ CProtocolManager::CProtocolManager() {
static const auto PENABLECT = CConfigValue<Hyprlang::INT>("render:commit_timing_enabled");
// Outputs are a bit dumb, we have to agree.
- static auto P = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
- auto M = std::any_cast<PHLMONITOR>(param);
-
+ static auto P = Event::bus()->m_events.monitor.added.listen([this](PHLMONITOR M) {
// ignore mirrored outputs. I don't think this will ever be hit as mirrors are applied after
// this event is emitted iirc.
// also ignore the fallback
@@ -132,8 +130,7 @@ CProtocolManager::CProtocolManager() {
m_modeChangeListeners[M->m_name] = M->m_events.modeChanged.listen([this, M] { onMonitorModeChange(M); });
});
- static auto P2 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
- auto M = std::any_cast<PHLMONITOR>(param);
+ static auto P2 = Event::bus()->m_events.monitor.removed.listen([this](PHLMONITOR M) {
if (!PROTO::outputs.contains(M->m_name))
return;
PROTO::outputs.at(M->m_name)->remove();