summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authoroutfoxxed <outfoxxed@outfoxxed.me>2025-07-08 09:56:40 -0700
committerGitHub <noreply@github.com>2025-07-08 18:56:40 +0200
commit78e9eddfb6bfbc6b103fc60c9831b23ef252886b (patch)
tree4daf06580d89dec717a282c4ec8729285241c8e8 /src/managers/input
parent2f34ef141b0728857d2a6f777c608dfe4c207733 (diff)
core: use new typed signals from hu (#10853)
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/IdleInhibitor.cpp6
-rw-r--r--src/managers/input/InputManager.cpp148
-rw-r--r--src/managers/input/InputManager.hpp6
-rw-r--r--src/managers/input/InputMethodPopup.cpp8
-rw-r--r--src/managers/input/InputMethodRelay.cpp15
-rw-r--r--src/managers/input/Tablets.cpp66
-rw-r--r--src/managers/input/TextInput.cpp27
7 files changed, 116 insertions, 160 deletions
diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp
index 258b35dc..8c33956b 100644
--- a/src/managers/input/IdleInhibitor.cpp
+++ b/src/managers/input/IdleInhibitor.cpp
@@ -10,7 +10,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->m_surface.get());
- PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.registerListener([this, PINHIBIT](std::any data) {
+ PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.listen([this, PINHIBIT] {
std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
recheckIdleInhibitorStatus();
});
@@ -24,8 +24,8 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
return;
}
- PINHIBIT->surfaceDestroyListener = WLSurface->m_events.destroy.registerListener(
- [this, PINHIBIT](std::any data) { std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); });
+ PINHIBIT->surfaceDestroyListener =
+ WLSurface->m_events.destroy.listen([this, PINHIBIT] { std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); });
recheckIdleInhibitorStatus();
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 434bd677..4d5bcb28 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -43,12 +43,10 @@
#include <aquamarine/input/Input.hpp>
CInputManager::CInputManager() {
- m_listeners.setCursorShape = PROTO::cursorShape->m_events.setShape.registerListener([this](std::any data) {
+ m_listeners.setCursorShape = PROTO::cursorShape->m_events.setShape.listen([this](const CCursorShapeProtocol::SSetShapeEvent& event) {
if (!cursorImageUnlocked())
return;
- auto event = std::any_cast<CCursorShapeProtocol::SSetShapeEvent>(data);
-
if (!g_pSeatManager->m_state.pointerFocusResource)
return;
@@ -66,16 +64,16 @@ CInputManager::CInputManager() {
g_pHyprRenderer->setCursorFromName(m_cursorSurfaceInfo.name);
});
- m_listeners.newIdleInhibitor = PROTO::idleInhibit->m_events.newIdleInhibitor.registerListener([this](std::any data) { this->newIdleInhibitor(data); });
- m_listeners.newVirtualKeyboard = PROTO::virtualKeyboard->m_events.newKeyboard.registerListener([this](std::any data) {
- this->newVirtualKeyboard(std::any_cast<SP<CVirtualKeyboardV1Resource>>(data));
+ m_listeners.newIdleInhibitor = PROTO::idleInhibit->m_events.newIdleInhibitor.listen([this](const auto& data) { this->newIdleInhibitor(data); });
+ m_listeners.newVirtualKeyboard = PROTO::virtualKeyboard->m_events.newKeyboard.listen([this](const auto& keyboard) {
+ this->newVirtualKeyboard(keyboard);
updateCapabilities();
});
- m_listeners.newVirtualMouse = PROTO::virtualPointer->m_events.newPointer.registerListener([this](std::any data) {
- this->newVirtualMouse(std::any_cast<SP<CVirtualPointerV1Resource>>(data));
+ m_listeners.newVirtualMouse = PROTO::virtualPointer->m_events.newPointer.listen([this](const auto& mouse) {
+ this->newVirtualMouse(mouse);
updateCapabilities();
});
- m_listeners.setCursor = g_pSeatManager->m_events.setCursor.registerListener([this](std::any d) { this->processMouseRequest(d); });
+ m_listeners.setCursor = g_pSeatManager->m_events.setCursor.listen([this](const auto& event) { this->processMouseRequest(event); });
m_cursorSurfaceInfo.wlSurface = CWLSurface::create();
}
@@ -641,23 +639,21 @@ void CInputManager::onMouseButton(IPointer::SButtonEvent e) {
}
}
-void CInputManager::processMouseRequest(std::any E) {
+void CInputManager::processMouseRequest(const CSeatManager::SSetCursorEvent& event) {
if (!cursorImageUnlocked())
return;
- auto e = std::any_cast<CSeatManager::SSetCursorEvent>(E);
-
- Debug::log(LOG, "cursorImage request: surface {:x}", (uintptr_t)e.surf.get());
+ Debug::log(LOG, "cursorImage request: surface {:x}", (uintptr_t)event.surf.get());
- if (e.surf != m_cursorSurfaceInfo.wlSurface->resource()) {
+ if (event.surf != m_cursorSurfaceInfo.wlSurface->resource()) {
m_cursorSurfaceInfo.wlSurface->unassign();
- if (e.surf)
- m_cursorSurfaceInfo.wlSurface->assign(e.surf);
+ if (event.surf)
+ m_cursorSurfaceInfo.wlSurface->assign(event.surf);
}
- if (e.surf) {
- m_cursorSurfaceInfo.vHotspot = e.hotspot;
+ if (event.surf) {
+ m_cursorSurfaceInfo.vHotspot = event.hotspot;
m_cursorSurfaceInfo.hidden = false;
} else {
m_cursorSurfaceInfo.vHotspot = {};
@@ -667,7 +663,7 @@ void CInputManager::processMouseRequest(std::any E) {
m_cursorSurfaceInfo.name = "";
m_cursorSurfaceInfo.inUse = true;
- g_pHyprRenderer->setCursorSurface(m_cursorSurfaceInfo.wlSurface, e.hotspot.x, e.hotspot.y);
+ g_pHyprRenderer->setCursorSurface(m_cursorSurfaceInfo.wlSurface, event.hotspot.x, event.hotspot.y);
}
void CInputManager::restoreCursorIconToApp() {
@@ -962,60 +958,52 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
Debug::log(ERR, "Keyboard had no name???"); // logic error
}
- keeb->m_events.destroy.registerStaticListener(
- [this](void* owner, std::any data) {
- auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
+ keeb->m_events.destroy.listenStatic([this, keeb = keeb.get()] {
+ auto PKEEB = keeb->m_self.lock();
- if (!PKEEB)
- return;
+ if (!PKEEB)
+ return;
- destroyKeyboard(PKEEB);
- Debug::log(LOG, "Destroyed keyboard {:x}", (uintptr_t)owner);
- },
- keeb.get());
+ destroyKeyboard(PKEEB);
+ Debug::log(LOG, "Destroyed keyboard {:x}", (uintptr_t)keeb);
+ });
- keeb->m_keyboardEvents.key.registerStaticListener(
- [this](void* owner, std::any data) {
- auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
+ keeb->m_keyboardEvents.key.listenStatic([this, keeb = keeb.get()](const IKeyboard::SKeyEvent& event) {
+ auto PKEEB = keeb->m_self.lock();
- onKeyboardKey(data, PKEEB);
+ onKeyboardKey(event, PKEEB);
- if (PKEEB->m_enabled)
- PROTO::idle->onActivity();
+ if (PKEEB->m_enabled)
+ PROTO::idle->onActivity();
- if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
- g_pKeybindManager->dpms("on");
- },
- keeb.get());
+ if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
+ g_pKeybindManager->dpms("on");
+ });
- keeb->m_keyboardEvents.modifiers.registerStaticListener(
- [this](void* owner, std::any data) {
- auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
+ keeb->m_keyboardEvents.modifiers.listenStatic([this, keeb = keeb.get()] {
+ auto PKEEB = keeb->m_self.lock();
- onKeyboardMod(PKEEB);
+ onKeyboardMod(PKEEB);
- if (PKEEB->m_enabled)
- PROTO::idle->onActivity();
+ if (PKEEB->m_enabled)
+ PROTO::idle->onActivity();
- if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
- g_pKeybindManager->dpms("on");
- },
- keeb.get());
+ if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
+ g_pKeybindManager->dpms("on");
+ });
- keeb->m_keyboardEvents.keymap.registerStaticListener(
- [](void* owner, std::any data) {
- auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
- const auto LAYOUT = PKEEB->getActiveLayout();
+ keeb->m_keyboardEvents.keymap.listenStatic([keeb = keeb.get()] {
+ auto PKEEB = keeb->m_self.lock();
+ const auto LAYOUT = PKEEB->getActiveLayout();
- if (PKEEB == g_pSeatManager->m_keyboard) {
- g_pSeatManager->updateActiveKeyboardData();
- g_pKeybindManager->m_keyToCodeCache.clear();
- }
+ if (PKEEB == g_pSeatManager->m_keyboard) {
+ g_pSeatManager->updateActiveKeyboardData();
+ g_pKeybindManager->m_keyToCodeCache.clear();
+ }
- g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->m_hlName + "," + LAYOUT});
- EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{PKEEB, LAYOUT}));
- },
- keeb.get());
+ g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->m_hlName + "," + LAYOUT});
+ EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{PKEEB, LAYOUT}));
+ });
disableAllKeyboards(false);
@@ -1148,16 +1136,7 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
setPointerConfigs();
- mauz->m_events.destroy.registerStaticListener(
- [this](void* mouse, std::any data) {
- const auto PMOUSE = (IPointer*)mouse;
-
- if (!PMOUSE)
- return;
-
- destroyPointer(PMOUSE->m_self.lock());
- },
- mauz.get());
+ mauz->m_events.destroy.listenStatic([this, PMOUSE = mauz.get()] { destroyPointer(PMOUSE->m_self.lock()); });
g_pSeatManager->setMouse(mauz);
@@ -1413,7 +1392,7 @@ void CInputManager::updateKeyboardsLeds(SP<IKeyboard> pKeyboard) {
}
}
-void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
+void CInputManager::onKeyboardKey(const IKeyboard::SKeyEvent& event, SP<IKeyboard> pKeyboard) {
if (!pKeyboard->m_enabled || !pKeyboard->m_allowed)
return;
@@ -1424,17 +1403,15 @@ void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
bool passEvent = DISALLOWACTION || g_pKeybindManager->onKeyEvent(event, pKeyboard);
- auto e = std::any_cast<IKeyboard::SKeyEvent>(event);
-
if (passEvent) {
const auto IME = m_relay.m_inputMethod.lock();
if (IME && IME->hasGrab() && !DISALLOWACTION) {
IME->setKeyboard(pKeyboard);
- IME->sendKey(e.timeMs, e.keycode, e.state);
+ IME->sendKey(event.timeMs, event.keycode, event.state);
} else {
g_pSeatManager->setKeyboard(pKeyboard);
- g_pSeatManager->sendKeyboardKey(e.timeMs, e.keycode, e.state);
+ g_pSeatManager->sendKeyboardKey(event.timeMs, event.keycode, event.state);
}
updateKeyboardsLeds(pKeyboard);
@@ -1627,16 +1604,14 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
setTouchDeviceConfigs(PNEWDEV);
g_pPointerManager->attachTouch(PNEWDEV);
- PNEWDEV->m_events.destroy.registerStaticListener(
- [this](void* owner, std::any data) {
- auto PDEV = ((ITouch*)owner)->m_self.lock();
+ PNEWDEV->m_events.destroy.listenStatic([this, dev = PNEWDEV.get()] {
+ auto PDEV = dev->m_self.lock();
- if (!PDEV)
- return;
+ if (!PDEV)
+ return;
- destroyTouchDevice(PDEV);
- },
- PNEWDEV.get());
+ destroyTouchDevice(PDEV);
+ });
Debug::log(LOG, "New touch device added at {:x}", (uintptr_t)PNEWDEV.get());
}
@@ -1739,17 +1714,16 @@ void CInputManager::newSwitch(SP<Aquamarine::ISwitch> pDevice) {
Debug::log(LOG, "New switch with name \"{}\" added", pDevice->getName());
- PNEWDEV->listeners.destroy = pDevice->events.destroy.registerListener([this, PNEWDEV](std::any d) { destroySwitch(PNEWDEV); });
+ PNEWDEV->listeners.destroy = pDevice->events.destroy.listen([this, PNEWDEV] { destroySwitch(PNEWDEV); });
- PNEWDEV->listeners.fire = pDevice->events.fire.registerListener([PNEWDEV](std::any d) {
+ PNEWDEV->listeners.fire = pDevice->events.fire.listen([PNEWDEV](const Aquamarine::ISwitch::SFireEvent& event) {
const auto NAME = PNEWDEV->pDevice->getName();
- const auto E = std::any_cast<Aquamarine::ISwitch::SFireEvent>(d);
Debug::log(LOG, "Switch {} fired, triggering binds.", NAME);
g_pKeybindManager->onSwitchEvent(NAME);
- if (E.enable) {
+ if (event.enable) {
Debug::log(LOG, "Switch {} turn on, triggering binds.", NAME);
g_pKeybindManager->onSwitchOnEvent(NAME);
} else {
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 549a72fa..1696dd0a 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -9,8 +9,10 @@
#include "../../helpers/signal/Signal.hpp"
#include "../../devices/IPointer.hpp"
#include "../../devices/ITouch.hpp"
+#include "../../devices/IKeyboard.hpp"
#include "../../devices/Tablet.hpp"
#include "../SessionLockManager.hpp"
+#include "../SeatManager.hpp"
class CPointerConstraint;
class CWindow;
@@ -89,7 +91,7 @@ class CInputManager {
void onMouseWarp(IPointer::SMotionAbsoluteEvent);
void onMouseButton(IPointer::SButtonEvent);
void onMouseWheel(IPointer::SAxisEvent);
- void onKeyboardKey(std::any, SP<IKeyboard>);
+ void onKeyboardKey(const IKeyboard::SKeyEvent&, SP<IKeyboard>);
void onKeyboardMod(SP<IKeyboard>);
void newKeyboard(SP<Aquamarine::IKeyboard>);
@@ -128,7 +130,7 @@ class CInputManager {
void setClickMode(eClickBehaviorMode);
eClickBehaviorMode getClickMode();
- void processMouseRequest(std::any e);
+ void processMouseRequest(const CSeatManager::SSetCursorEvent& event);
void onTouchDown(ITouch::SDownEvent);
void onTouchUp(ITouch::SUpEvent);
diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp
index 98131168..71fdd5a4 100644
--- a/src/managers/input/InputMethodPopup.cpp
+++ b/src/managers/input/InputMethodPopup.cpp
@@ -8,10 +8,10 @@
#include "../../render/Renderer.hpp"
CInputPopup::CInputPopup(SP<CInputMethodPopupV2> popup_) : m_popup(popup_) {
- m_listeners.commit = popup_->m_events.commit.registerListener([this](std::any d) { onCommit(); });
- m_listeners.map = popup_->m_events.map.registerListener([this](std::any d) { onMap(); });
- m_listeners.unmap = popup_->m_events.unmap.registerListener([this](std::any d) { onUnmap(); });
- m_listeners.destroy = popup_->m_events.destroy.registerListener([this](std::any d) { onDestroy(); });
+ m_listeners.commit = popup_->m_events.commit.listen([this] { onCommit(); });
+ m_listeners.map = popup_->m_events.map.listen([this] { onMap(); });
+ m_listeners.unmap = popup_->m_events.unmap.listen([this] { onUnmap(); });
+ m_listeners.destroy = popup_->m_events.destroy.listen([this] { onDestroy(); });
m_surface = CWLSurface::create();
m_surface->assign(popup_->surface());
}
diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp
index 40c87f95..c09d0624 100644
--- a/src/managers/input/InputMethodRelay.cpp
+++ b/src/managers/input/InputMethodRelay.cpp
@@ -11,9 +11,9 @@ CInputMethodRelay::CInputMethodRelay() {
static auto P =
g_pHookSystem->hookDynamic("keyboardFocus", [&](void* self, SCallbackInfo& info, std::any param) { onKeyboardFocus(std::any_cast<SP<CWLSurfaceResource>>(param)); });
- m_listeners.newTIV3 = PROTO::textInputV3->m_events.newTextInput.registerListener([this](std::any ti) { onNewTextInput(std::any_cast<WP<CTextInputV3>>(ti)); });
- m_listeners.newTIV1 = PROTO::textInputV1->m_events.newTextInput.registerListener([this](std::any ti) { onNewTextInput(std::any_cast<WP<CTextInputV1>>(ti)); });
- m_listeners.newIME = PROTO::ime->m_events.newIME.registerListener([this](std::any ime) { onNewIME(std::any_cast<SP<CInputMethodV2>>(ime)); });
+ m_listeners.newTIV3 = PROTO::textInputV3->m_events.newTextInput.listen([this](const auto& input) { onNewTextInput(input); });
+ m_listeners.newTIV1 = PROTO::textInputV1->m_events.newTextInput.listen([this](const auto& input) { onNewTextInput(input); });
+ m_listeners.newIME = PROTO::ime->m_events.newIME.listen([this](const auto& ime) { onNewIME(ime); });
}
void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
@@ -27,7 +27,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
m_inputMethod = pIME;
- m_listeners.commitIME = pIME->m_events.onCommit.registerListener([this](std::any d) {
+ m_listeners.commitIME = pIME->m_events.onCommit.listen([this] {
const auto PTI = getFocusedTextInput();
if (!PTI) {
@@ -38,7 +38,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
PTI->updateIMEState(m_inputMethod.lock());
});
- m_listeners.destroyIME = pIME->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroyIME = pIME->m_events.destroy.listen([this] {
const auto PTI = getFocusedTextInput();
Debug::log(LOG, "IME Destroy");
@@ -49,9 +49,8 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
m_inputMethod.reset();
});
- m_listeners.newPopup = pIME->m_events.newPopup.registerListener([this](std::any d) {
- m_inputMethodPopups.emplace_back(makeUnique<CInputPopup>(std::any_cast<SP<CInputMethodPopupV2>>(d)));
-
+ m_listeners.newPopup = pIME->m_events.newPopup.listen([this](const SP<CInputMethodPopupV2>& popup) {
+ m_inputMethodPopups.emplace_back(makeUnique<CInputPopup>(popup));
Debug::log(LOG, "New input popup");
});
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index b0fe7c64..5a0c5dbe 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -229,12 +229,10 @@ void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
g_pPointerManager->attachTablet(PNEWTABLET);
- PNEWTABLET->m_events.destroy.registerStaticListener(
- [this](void* owner, std::any d) {
- auto TABLET = ((CTablet*)owner)->m_self;
- destroyTablet(TABLET.lock());
- },
- PNEWTABLET.get());
+ PNEWTABLET->m_events.destroy.listenStatic([this, tablet = PNEWTABLET.get()] {
+ auto TABLET = tablet->m_self;
+ destroyTablet(TABLET.lock());
+ });
setTabletConfigs();
}
@@ -255,12 +253,10 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo
Debug::log(ERR, "Tablet had no name???"); // logic error
}
- PTOOL->m_events.destroy.registerStaticListener(
- [this](void* owner, std::any d) {
- auto TOOL = ((CTabletTool*)owner)->m_self;
- destroyTabletTool(TOOL.lock());
- },
- PTOOL.get());
+ PTOOL->m_events.destroy.listenStatic([this, tool = PTOOL.get()] {
+ auto TOOL = tool->m_self;
+ destroyTabletTool(TOOL.lock());
+ });
return PTOOL;
}
@@ -275,39 +271,27 @@ void CInputManager::newTabletPad(SP<Aquamarine::ITabletPad> pDevice) {
Debug::log(ERR, "Pad had no name???"); // logic error
}
- // clang-format off
- PNEWPAD->m_events.destroy.registerStaticListener([this](void* owner, std::any d) {
- auto PAD = ((CTabletPad*)owner)->m_self;
+ PNEWPAD->m_events.destroy.listenStatic([this, pad = PNEWPAD.get()] {
+ auto PAD = pad->m_self;
destroyTabletPad(PAD.lock());
- }, PNEWPAD.get());
+ });
- PNEWPAD->m_padEvents.button.registerStaticListener([](void* owner, std::any e) {
- const auto E = std::any_cast<CTabletPad::SButtonEvent>(e);
- const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
+ PNEWPAD->m_padEvents.button.listenStatic([pad = PNEWPAD.get()](const CTabletPad::SButtonEvent& event) {
+ const auto PPAD = pad->m_self.lock();
- PROTO::tablet->mode(PPAD, 0, E.mode, E.timeMs);
- PROTO::tablet->buttonPad(PPAD, E.button, E.timeMs, E.down);
- }, PNEWPAD.get());
+ PROTO::tablet->mode(PPAD, 0, event.mode, event.timeMs);
+ PROTO::tablet->buttonPad(PPAD, event.button, event.timeMs, event.down);
+ });
- PNEWPAD->m_padEvents.strip.registerStaticListener([](void* owner, std::any e) {
- const auto E = std::any_cast<CTabletPad::SStripEvent>(e);
- const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
+ PNEWPAD->m_padEvents.strip.listenStatic([pad = PNEWPAD.get()](const CTabletPad::SStripEvent& event) {
+ const auto PPAD = pad->m_self.lock();
+ PROTO::tablet->strip(PPAD, event.strip, event.position, event.finger, event.timeMs);
+ });
- PROTO::tablet->strip(PPAD, E.strip, E.position, E.finger, E.timeMs);
- }, PNEWPAD.get());
+ PNEWPAD->m_padEvents.ring.listenStatic([pad = PNEWPAD.get()](const CTabletPad::SRingEvent& event) {
+ const auto PPAD = pad->m_self.lock();
+ PROTO::tablet->ring(PPAD, event.ring, event.position, event.finger, event.timeMs);
+ });
- PNEWPAD->m_padEvents.ring.registerStaticListener([](void* owner, std::any e) {
- const auto E = std::any_cast<CTabletPad::SRingEvent>(e);
- const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
-
- PROTO::tablet->ring(PPAD, E.ring, E.position, E.finger, E.timeMs);
- }, PNEWPAD.get());
-
- PNEWPAD->m_padEvents.attach.registerStaticListener([](void* owner, std::any e) {
- const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
- const auto TOOL = std::any_cast<SP<CTabletTool>>(e);
-
- PPAD->m_parent = TOOL;
- }, PNEWPAD.get());
- // clang-format on
+ PNEWPAD->m_padEvents.attach.listenStatic([pad = PNEWPAD.get()](const SP<CTabletTool>& tool) { pad->m_parent = tool; });
}
diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp
index cac64da4..c1ce2062 100644
--- a/src/managers/input/TextInput.cpp
+++ b/src/managers/input/TextInput.cpp
@@ -19,11 +19,11 @@ void CTextInput::initCallbacks() {
if (isV3()) {
const auto INPUT = m_v3Input.lock();
- m_listeners.enable = INPUT->m_events.enable.registerListener([this](std::any p) { onEnabled(); });
- m_listeners.disable = INPUT->m_events.disable.registerListener([this](std::any p) { onDisabled(); });
- m_listeners.commit = INPUT->m_events.onCommit.registerListener([this](std::any p) { onCommit(); });
- m_listeners.reset = INPUT->m_events.reset.registerListener([this](std::any p) { onReset(); });
- m_listeners.destroy = INPUT->m_events.destroy.registerListener([this](std::any p) {
+ m_listeners.enable = INPUT->m_events.enable.listen([this] { onEnabled(); });
+ m_listeners.disable = INPUT->m_events.disable.listen([this] { onDisabled(); });
+ m_listeners.commit = INPUT->m_events.onCommit.listen([this] { onCommit(); });
+ m_listeners.reset = INPUT->m_events.reset.listen([this] { onReset(); });
+ m_listeners.destroy = INPUT->m_events.destroy.listen([this] {
m_listeners.surfaceUnmap.reset();
m_listeners.surfaceDestroy.reset();
g_pInputManager->m_relay.removeTextInput(this);
@@ -36,14 +36,11 @@ void CTextInput::initCallbacks() {
} else {
const auto INPUT = m_v1Input.lock();
- m_listeners.enable = INPUT->m_events.enable.registerListener([this](std::any p) {
- const auto SURFACE = std::any_cast<SP<CWLSurfaceResource>>(p);
- onEnabled(SURFACE);
- });
- m_listeners.disable = INPUT->m_events.disable.registerListener([this](std::any p) { onDisabled(); });
- m_listeners.commit = INPUT->m_events.onCommit.registerListener([this](std::any p) { onCommit(); });
- m_listeners.reset = INPUT->m_events.reset.registerListener([this](std::any p) { onReset(); });
- m_listeners.destroy = INPUT->m_events.destroy.registerListener([this](std::any p) {
+ m_listeners.enable = INPUT->m_events.enable.listen([this](const auto& surface) { onEnabled(surface); });
+ m_listeners.disable = INPUT->m_events.disable.listen([this] { onDisabled(); });
+ m_listeners.commit = INPUT->m_events.onCommit.listen([this] { onCommit(); });
+ m_listeners.reset = INPUT->m_events.reset.listen([this] { onReset(); });
+ m_listeners.destroy = INPUT->m_events.destroy.listen([this] {
m_listeners.surfaceUnmap.reset();
m_listeners.surfaceDestroy.reset();
g_pInputManager->m_relay.removeTextInput(this);
@@ -135,7 +132,7 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) {
m_listeners.surfaceUnmap.reset();
m_listeners.surfaceDestroy.reset();
- m_listeners.surfaceUnmap = pSurface->m_events.unmap.registerListener([this](std::any d) {
+ m_listeners.surfaceUnmap = pSurface->m_events.unmap.listen([this] {
Debug::log(LOG, "Unmap TI owner1");
if (m_enterLocks)
@@ -155,7 +152,7 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) {
g_pInputManager->m_relay.deactivateIME(this);
});
- m_listeners.surfaceDestroy = pSurface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.surfaceDestroy = pSurface->m_events.destroy.listen([this] {
Debug::log(LOG, "Destroy TI owner1");
if (m_enterLocks)