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/input/Touch.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/input/Touch.cpp')
| -rw-r--r-- | src/managers/input/Touch.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 6136cb3f..e45bfd28 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -7,8 +7,8 @@ #include "../../config/ConfigValue.hpp" #include "../../helpers/Monitor.hpp" #include "../../devices/ITouch.hpp" +#include "../../event/EventBus.hpp" #include "../SeatManager.hpp" -#include "../HookSystemManager.hpp" #include "debug/log/Logger.hpp" #include "UnifiedWorkspaceSwipeGesture.hpp" @@ -19,10 +19,14 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out"); auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData()); // TODO: WORKSPACERULE.gapsOut.value_or() - auto gapsOut = *PGAPSOUT; - static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size"); - static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert"); - EMIT_HOOK_EVENT_CANCELLABLE("touchDown", e); + auto gapsOut = *PGAPSOUT; + static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size"); + static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert"); + + Event::SCallbackInfo info; + Event::bus()->m_events.input.touch.down.emit(e, info); + if (info.cancelled) + return; auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : ""); @@ -109,7 +113,11 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { void CInputManager::onTouchUp(ITouch::SUpEvent e) { m_lastInputTouch = true; - EMIT_HOOK_EVENT_CANCELLABLE("touchUp", e); + Event::SCallbackInfo info; + Event::bus()->m_events.input.touch.up.emit(e, info); + if (info.cancelled) + return; + if (g_pUnifiedWorkspaceSwipe->isGestureInProgress()) { // If there was a swipe from this finger, end it. if (e.touchID == g_pUnifiedWorkspaceSwipe->m_touchID) @@ -126,7 +134,11 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { m_lastCursorMovement.reset(); - EMIT_HOOK_EVENT_CANCELLABLE("touchMove", e); + Event::SCallbackInfo info; + Event::bus()->m_events.input.touch.motion.emit(e, info); + if (info.cancelled) + return; + if (g_pUnifiedWorkspaceSwipe->isGestureInProgress()) { // Do nothing if this is using a different finger. if (e.touchID != g_pUnifiedWorkspaceSwipe->m_touchID) |
