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/desktop/state/FocusState.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/desktop/state/FocusState.cpp') diff --git a/src/desktop/state/FocusState.cpp b/src/desktop/state/FocusState.cpp index 90524b74..c1298766 100644 --- a/src/desktop/state/FocusState.cpp +++ b/src/desktop/state/FocusState.cpp @@ -4,13 +4,13 @@ #include "../../protocols/XDGShell.hpp" #include "../../render/Renderer.hpp" #include "../../managers/EventManager.hpp" -#include "../../managers/HookSystemManager.hpp" #include "../../managers/input/InputManager.hpp" #include "../../managers/SeatManager.hpp" #include "../../xwayland/XSurface.hpp" #include "../../protocols/PointerConstraints.hpp" #include "managers/animation/DesktopAnimationManager.hpp" #include "../../layout/LayoutManager.hpp" +#include "../../event/EventBus.hpp" using namespace Desktop; @@ -133,7 +133,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, eFocusReason reason, SPpostEvent(SHyprIPCEvent{"activewindow", ","}); g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ""}); - EMIT_HOOK_EVENT("activeWindow", Desktop::View::SWindowActiveEvent{nullptr COMMA reason}); + Event::bus()->m_events.window.active.emit(nullptr, reason); m_focusSurface.reset(); @@ -200,7 +200,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, eFocusReason reason, SPpostEvent(SHyprIPCEvent{.event = "activewindow", .data = pWindow->m_class + "," + pWindow->m_title}); g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", rc(pWindow.get()))}); - EMIT_HOOK_EVENT("activeWindow", Desktop::View::SWindowActiveEvent{pWindow COMMA reason}); + Event::bus()->m_events.window.active.emit(pWindow, reason); g_pInputManager->recheckIdleInhibitorStatus(); @@ -233,7 +233,7 @@ void CFocusState::rawSurfaceFocus(SP pSurface, PHLWINDOW pWi g_pSeatManager->setKeyboardFocus(nullptr); g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindow", .data = ","}); g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = ""}); - EMIT_HOOK_EVENT("keyboardFocus", SP{nullptr}); + Event::bus()->m_events.input.keyboard.focus.emit(nullptr); m_focusSurface.reset(); return; } @@ -249,7 +249,7 @@ void CFocusState::rawSurfaceFocus(SP pSurface, PHLWINDOW pWi g_pXWaylandManager->activateSurface(pSurface, true); m_focusSurface = pSurface; - EMIT_HOOK_EVENT("keyboardFocus", pSurface); + Event::bus()->m_events.input.keyboard.focus.emit(pSurface); const auto SURF = Desktop::View::CWLSurface::fromResource(pSurface); const auto OLDSURF = Desktop::View::CWLSurface::fromResource(PLASTSURF); @@ -278,7 +278,7 @@ void CFocusState::rawMonitorFocus(PHLMONITOR pMonitor) { g_pEventManager->postEvent(SHyprIPCEvent{.event = "focusedmon", .data = pMonitor->m_name + "," + WORKSPACE_NAME}); g_pEventManager->postEvent(SHyprIPCEvent{.event = "focusedmonv2", .data = pMonitor->m_name + "," + WORKSPACE_ID}); - EMIT_HOOK_EVENT("focusedMon", pMonitor); + Event::bus()->m_events.monitor.focused.emit(pMonitor); m_focusMonitor = pMonitor; } -- cgit v1.2.3