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/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp') diff --git a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp index 65533e71..6e9e822c 100644 --- a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp +++ b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp @@ -10,6 +10,7 @@ #include "../../../../desktop/history/WindowHistoryTracker.hpp" #include "../../../../helpers/Monitor.hpp" #include "../../../../Compositor.hpp" +#include "../../../../event/EventBus.hpp" #include #include @@ -22,16 +23,14 @@ using namespace Layout::Tiled; CMonocleAlgorithm::CMonocleAlgorithm() { // hook into focus changes to bring focused window to front - m_focusCallback = g_pHookSystem->hookDynamic("activeWindow", [this](void* hk, SCallbackInfo& info, std::any param) { - const auto PWINDOW = std::any_cast(param).window; - - if (!PWINDOW) + m_focusCallback = Event::bus()->m_events.window.active.listen([this](PHLWINDOW pWindow, Desktop::eFocusReason reason) { + if (!pWindow) return; - if (!PWINDOW->m_workspace->isVisible()) + if (!pWindow->m_workspace->isVisible()) return; - const auto TARGET = PWINDOW->layoutTarget(); + const auto TARGET = pWindow->layoutTarget(); if (!TARGET) return; -- cgit v1.2.3