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/input/Tablets.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/managers/input/Tablets.cpp') diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 52be6eee..a2fec15c 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -2,11 +2,11 @@ #include "../../desktop/view/Window.hpp" #include "../../protocols/Tablet.hpp" #include "../../devices/Tablet.hpp" -#include "../../managers/HookSystemManager.hpp" #include "../../managers/PointerManager.hpp" #include "../../managers/SeatManager.hpp" #include "../../protocols/PointerConstraints.hpp" #include "../../protocols/core/DataDevice.hpp" +#include "../../event/EventBus.hpp" static void unfocusTool(SP tool) { if (!tool->getSurface()) @@ -107,6 +107,11 @@ static Vector2D transformToActiveRegion(const Vector2D pos, const CBox activeAre } void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { + Event::SCallbackInfo info; + Event::bus()->m_events.input.tablet.axis.emit(e, info); + if (info.cancelled) + return; + const auto PTAB = e.tablet; const auto PTOOL = ensureTabletToolPresent(e.tool); @@ -171,7 +176,10 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { } void CInputManager::onTabletTip(CTablet::STipEvent e) { - EMIT_HOOK_EVENT_CANCELLABLE("tabletTip", e); + Event::SCallbackInfo info; + Event::bus()->m_events.input.tablet.tip.emit(e, info); + if (info.cancelled) + return; const auto PTAB = e.tablet; const auto PTOOL = ensureTabletToolPresent(e.tool); @@ -196,6 +204,11 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) { } void CInputManager::onTabletButton(CTablet::SButtonEvent e) { + Event::SCallbackInfo info; + Event::bus()->m_events.input.tablet.button.emit(e, info); + if (info.cancelled) + return; + const auto PTOOL = ensureTabletToolPresent(e.tool); if (e.down) @@ -210,6 +223,11 @@ void CInputManager::onTabletButton(CTablet::SButtonEvent e) { } void CInputManager::onTabletProximity(CTablet::SProximityEvent e) { + Event::SCallbackInfo info; + Event::bus()->m_events.input.tablet.proximity.emit(e, info); + if (info.cancelled) + return; + const auto PTAB = e.tablet; const auto PTOOL = ensureTabletToolPresent(e.tool); -- cgit v1.2.3