diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-22 23:30:10 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-22 23:30:10 +0000 |
| commit | b88813c7efa4b7b0c5fe01471c5fa5b67a61dc7e (patch) | |
| tree | 4454e82bc033d7e28a23ee372d0e3f48341d0aaa /src/managers/KeybindManager.cpp | |
| parent | b4ee4674f9a74e3d602c7fb17bc09f79d221583c (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/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 777f6bbe..e815579f 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -16,7 +16,6 @@ #include "TokenManager.hpp" #include "eventLoop/EventLoopManager.hpp" #include "debug/log/Logger.hpp" -#include "../managers/HookSystemManager.hpp" #include "../managers/input/InputManager.hpp" #include "../managers/animation/DesktopAnimationManager.hpp" #include "../managers/EventManager.hpp" @@ -32,6 +31,7 @@ #include "../layout/algorithm/Algorithm.hpp" #include "../layout/algorithm/tiled/master/MasterAlgorithm.hpp" #include "../layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp" +#include "../event/EventBus.hpp" #include <optional> #include <iterator> @@ -203,8 +203,7 @@ CKeybindManager::CKeybindManager() { g_pEventLoopManager->addTimer(m_repeatKeyTimer); } - static auto P = g_pHookSystem->hookDynamic("configReloaded", [this](void* hk, SCallbackInfo& info, std::any param) { - // clear cuz realloc'd + static auto P = Event::bus()->m_events.config.reloaded.listen([this] { m_activeKeybinds.clear(); m_lastLongPressKeybind.reset(); m_pressedSpecialBinds.clear(); @@ -2215,7 +2214,7 @@ SDispatchResult CKeybindManager::setSubmap(std::string submap) { m_currentSelectedSubmap.name = ""; Log::logger->log(Log::DEBUG, "Reset active submap to the default one."); g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""}); - EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name); + Event::bus()->m_events.keybinds.submap.emit(m_currentSelectedSubmap.name); return {}; } @@ -2224,7 +2223,7 @@ SDispatchResult CKeybindManager::setSubmap(std::string submap) { m_currentSelectedSubmap.name = submap; Log::logger->log(Log::DEBUG, "Changed keybind submap to {}", submap); g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap}); - EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap.name); + Event::bus()->m_events.keybinds.submap.emit(m_currentSelectedSubmap.name); return {}; } } @@ -2584,7 +2583,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) { g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS); g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", rc<uintptr_t>(PWINDOW.get()), sc<int>(PWINDOW->m_pinned))}); - EMIT_HOOK_EVENT("pin", PWINDOW); + Event::bus()->m_events.window.pin.emit(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW, true); |
