From b88813c7efa4b7b0c5fe01471c5fa5b67a61dc7e Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 22 Feb 2026 23:30:10 +0000 Subject: event: refactor HookSystem into a typed event bus (#13333) Refactors the old HookSystem into a typed event bus with clear separation, discovery and types. --- src/managers/ProtocolManager.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/managers/ProtocolManager.cpp') 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("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(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(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(); -- cgit v1.2.3