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/ANRManager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/managers/ANRManager.cpp') diff --git a/src/managers/ANRManager.cpp b/src/managers/ANRManager.cpp index 43d2d080..9f613df8 100644 --- a/src/managers/ANRManager.cpp +++ b/src/managers/ANRManager.cpp @@ -3,13 +3,13 @@ #include "../helpers/fs/FsUtils.hpp" #include "../debug/log/Logger.hpp" #include "../macros.hpp" -#include "HookSystemManager.hpp" #include "../Compositor.hpp" #include "../protocols/XDGShell.hpp" #include "./eventLoop/EventLoopManager.hpp" #include "../config/ConfigValue.hpp" #include "../xwayland/XSurface.hpp" #include "../i18n/Engine.hpp" +#include "../event/EventBus.hpp" using namespace Hyprutils::OS; @@ -26,9 +26,7 @@ CANRManager::CANRManager() { m_active = true; - static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) { - auto window = std::any_cast(data); - + static auto P = Event::bus()->m_events.window.open.listen([this](PHLWINDOW window) { for (const auto& d : m_data) { // Window is ANR dialog if (d->isRunning() && d->dialogBox->getPID() == window->getPID()) @@ -41,9 +39,7 @@ CANRManager::CANRManager() { m_data.emplace_back(makeShared(window)); }); - static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) { - auto window = std::any_cast(data); - + static auto P1 = Event::bus()->m_events.window.close.listen([this](PHLWINDOW window) { for (const auto& d : m_data) { if (!d->fitsWindow(window)) continue; -- cgit v1.2.3