summaryrefslogtreecommitdiff
path: root/src
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
parent2f34ef141b0728857d2a6f777c608dfe4c207733 (diff)
core: use new typed signals from hu (#10853)
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp137
-rw-r--r--src/desktop/LayerSurface.cpp8
-rw-r--r--src/desktop/Popup.cpp20
-rw-r--r--src/desktop/Subsurface.cpp17
-rw-r--r--src/desktop/WLSurface.cpp2
-rw-r--r--src/desktop/WLSurface.hpp2
-rw-r--r--src/desktop/Window.cpp34
-rw-r--r--src/desktop/Window.hpp2
-rw-r--r--src/desktop/Workspace.cpp2
-rw-r--r--src/desktop/Workspace.hpp8
-rw-r--r--src/devices/IHID.hpp4
-rw-r--r--src/devices/IKeyboard.hpp8
-rw-r--r--src/devices/IPointer.hpp32
-rw-r--r--src/devices/ITouch.hpp12
-rw-r--r--src/devices/Keyboard.cpp16
-rw-r--r--src/devices/Mouse.cpp120
-rw-r--r--src/devices/Tablet.cpp114
-rw-r--r--src/devices/Tablet.hpp18
-rw-r--r--src/devices/TouchDevice.cpp40
-rw-r--r--src/devices/VirtualKeyboard.cpp16
-rw-r--r--src/devices/VirtualPointer.cpp38
-rw-r--r--src/helpers/Monitor.cpp41
-rw-r--r--src/helpers/Monitor.hpp10
-rw-r--r--src/managers/PointerManager.cpp172
-rw-r--r--src/managers/ProtocolManager.cpp2
-rw-r--r--src/managers/SeatManager.cpp16
-rw-r--r--src/managers/SeatManager.hpp14
-rw-r--r--src/managers/SessionLockManager.cpp23
-rw-r--r--src/managers/eventLoop/EventLoopManager.cpp2
-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
-rw-r--r--src/protocols/AlphaModifier.cpp4
-rw-r--r--src/protocols/ContentType.cpp2
-rw-r--r--src/protocols/CursorShape.hpp4
-rw-r--r--src/protocols/DRMLease.cpp4
-rw-r--r--src/protocols/DRMSyncobj.cpp2
-rw-r--r--src/protocols/ExtWorkspace.cpp18
-rw-r--r--src/protocols/FocusGrab.cpp2
-rw-r--r--src/protocols/GammaControl.cpp4
-rw-r--r--src/protocols/HyprlandSurface.cpp4
-rw-r--r--src/protocols/IdleInhibit.cpp4
-rw-r--r--src/protocols/IdleInhibit.hpp4
-rw-r--r--src/protocols/InputMethodV2.cpp4
-rw-r--r--src/protocols/InputMethodV2.hpp18
-rw-r--r--src/protocols/LayerShell.cpp6
-rw-r--r--src/protocols/LayerShell.hpp11
-rw-r--r--src/protocols/LinuxDMABUF.cpp2
-rw-r--r--src/protocols/MesaDRM.cpp2
-rw-r--r--src/protocols/OutputManagement.cpp4
-rw-r--r--src/protocols/OutputPower.cpp10
-rw-r--r--src/protocols/PointerConstraints.cpp2
-rw-r--r--src/protocols/PrimarySelection.cpp2
-rw-r--r--src/protocols/SessionLock.cpp6
-rw-r--r--src/protocols/SessionLock.hpp14
-rw-r--r--src/protocols/SinglePixel.cpp2
-rw-r--r--src/protocols/TextInputV1.hpp12
-rw-r--r--src/protocols/TextInputV3.hpp14
-rw-r--r--src/protocols/Viewporter.cpp2
-rw-r--r--src/protocols/VirtualKeyboard.hpp12
-rw-r--r--src/protocols/VirtualPointer.cpp2
-rw-r--r--src/protocols/VirtualPointer.hpp36
-rw-r--r--src/protocols/XDGShell.cpp6
-rw-r--r--src/protocols/XDGShell.hpp28
-rw-r--r--src/protocols/XWaylandShell.hpp4
-rw-r--r--src/protocols/core/Compositor.hpp14
-rw-r--r--src/protocols/core/DataDevice.cpp8
-rw-r--r--src/protocols/core/Output.cpp2
-rw-r--r--src/protocols/core/Output.hpp2
-rw-r--r--src/protocols/core/Seat.cpp6
-rw-r--r--src/protocols/core/Seat.hpp4
-rw-r--r--src/protocols/core/Shm.cpp2
-rw-r--r--src/protocols/core/Subcompositor.cpp2
-rw-r--r--src/protocols/core/Subcompositor.hpp2
-rw-r--r--src/protocols/types/Buffer.cpp2
-rw-r--r--src/protocols/types/DMABuffer.cpp2
-rw-r--r--src/protocols/types/DataDevice.hpp2
-rw-r--r--src/render/Renderbuffer.cpp2
-rw-r--r--src/xwayland/XSurface.cpp8
-rw-r--r--src/xwayland/XSurface.hpp20
-rw-r--r--src/xwayland/XWM.cpp13
85 files changed, 675 insertions, 873 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 3c0a4ec3..8873d7f2 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -405,90 +405,67 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
}
void CCompositor::initAllSignals() {
- m_aqBackend->events.newOutput.registerStaticListener(
- [this](void* p, std::any data) {
- auto output = std::any_cast<SP<Aquamarine::IOutput>>(data);
- Debug::log(LOG, "New aquamarine output with name {}", output->name);
- if (m_initialized)
- onNewMonitor(output);
- else
- pendingOutputs.emplace_back(output);
- },
- nullptr);
-
- m_aqBackend->events.newPointer.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::IPointer>>(d);
- Debug::log(LOG, "New aquamarine pointer with name {}", dev->getName());
- g_pInputManager->newMouse(dev);
- g_pInputManager->updateCapabilities();
- },
- nullptr);
-
- m_aqBackend->events.newKeyboard.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::IKeyboard>>(d);
- Debug::log(LOG, "New aquamarine keyboard with name {}", dev->getName());
- g_pInputManager->newKeyboard(dev);
- g_pInputManager->updateCapabilities();
- },
- nullptr);
-
- m_aqBackend->events.newTouch.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::ITouch>>(d);
- Debug::log(LOG, "New aquamarine touch with name {}", dev->getName());
- g_pInputManager->newTouchDevice(dev);
- g_pInputManager->updateCapabilities();
- },
- nullptr);
+ m_aqBackend->events.newOutput.listenStatic([this](const SP<Aquamarine::IOutput>& output) {
+ Debug::log(LOG, "New aquamarine output with name {}", output->name);
+ if (m_initialized)
+ onNewMonitor(output);
+ else
+ pendingOutputs.emplace_back(output);
+ });
- m_aqBackend->events.newSwitch.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::ISwitch>>(d);
- Debug::log(LOG, "New aquamarine switch with name {}", dev->getName());
- g_pInputManager->newSwitch(dev);
- },
- nullptr);
+ m_aqBackend->events.newPointer.listenStatic([](const SP<Aquamarine::IPointer>& dev) {
+ Debug::log(LOG, "New aquamarine pointer with name {}", dev->getName());
+ g_pInputManager->newMouse(dev);
+ g_pInputManager->updateCapabilities();
+ });
- m_aqBackend->events.newTablet.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::ITablet>>(d);
- Debug::log(LOG, "New aquamarine tablet with name {}", dev->getName());
- g_pInputManager->newTablet(dev);
- },
- nullptr);
+ m_aqBackend->events.newKeyboard.listenStatic([](const SP<Aquamarine::IKeyboard>& dev) {
+ Debug::log(LOG, "New aquamarine keyboard with name {}", dev->getName());
+ g_pInputManager->newKeyboard(dev);
+ g_pInputManager->updateCapabilities();
+ });
- m_aqBackend->events.newTabletPad.registerStaticListener(
- [](void* data, std::any d) {
- auto dev = std::any_cast<SP<Aquamarine::ITabletPad>>(d);
- Debug::log(LOG, "New aquamarine tablet pad with name {}", dev->getName());
- g_pInputManager->newTabletPad(dev);
- },
- nullptr);
+ m_aqBackend->events.newTouch.listenStatic([](const SP<Aquamarine::ITouch>& dev) {
+ Debug::log(LOG, "New aquamarine touch with name {}", dev->getName());
+ g_pInputManager->newTouchDevice(dev);
+ g_pInputManager->updateCapabilities();
+ });
- if (m_aqBackend->hasSession()) {
- m_aqBackend->session->events.changeActive.registerStaticListener(
- [this](void*, std::any) {
- if (m_aqBackend->session->active) {
- Debug::log(LOG, "Session got activated!");
+ m_aqBackend->events.newSwitch.listenStatic([](const SP<Aquamarine::ISwitch>& dev) {
+ Debug::log(LOG, "New aquamarine switch with name {}", dev->getName());
+ g_pInputManager->newSwitch(dev);
+ });
+
+ m_aqBackend->events.newTablet.listenStatic([](const SP<Aquamarine::ITablet>& dev) {
+ Debug::log(LOG, "New aquamarine tablet with name {}", dev->getName());
+ g_pInputManager->newTablet(dev);
+ });
- m_sessionActive = true;
+ m_aqBackend->events.newTabletPad.listenStatic([](const SP<Aquamarine::ITabletPad>& dev) {
+ Debug::log(LOG, "New aquamarine tablet pad with name {}", dev->getName());
+ g_pInputManager->newTabletPad(dev);
+ });
- for (auto const& m : m_monitors) {
- scheduleFrameForMonitor(m);
- m->applyMonitorRule(&m->m_activeMonitorRule, true);
- }
+ if (m_aqBackend->hasSession()) {
+ m_aqBackend->session->events.changeActive.listenStatic([this] {
+ if (m_aqBackend->session->active) {
+ Debug::log(LOG, "Session got activated!");
- g_pConfigManager->m_wantsMonitorReload = true;
- g_pCursorManager->syncGsettings();
- } else {
- Debug::log(LOG, "Session got deactivated!");
+ m_sessionActive = true;
- m_sessionActive = false;
+ for (auto const& m : m_monitors) {
+ scheduleFrameForMonitor(m);
+ m->applyMonitorRule(&m->m_activeMonitorRule, true);
}
- },
- nullptr);
+
+ g_pConfigManager->m_wantsMonitorReload = true;
+ g_pCursorManager->syncGsettings();
+ } else {
+ Debug::log(LOG, "Session got deactivated!");
+
+ m_sessionActive = false;
+ }
+ });
}
}
@@ -1973,7 +1950,7 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor
const auto PWORKSPACEB = pMonitorB->m_activeWorkspace;
PWORKSPACEA->m_monitor = pMonitorB;
- PWORKSPACEA->m_events.monitorChange.emit();
+ PWORKSPACEA->m_events.monitorChanged.emit();
for (auto const& w : m_windows) {
if (w->m_workspace == PWORKSPACEA) {
@@ -1998,7 +1975,7 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor
}
PWORKSPACEB->m_monitor = pMonitorA;
- PWORKSPACEB->m_events.monitorChange.emit();
+ PWORKSPACEB->m_events.monitorChanged.emit();
for (auto const& w : m_windows) {
if (w->m_workspace == PWORKSPACEB) {
@@ -2178,7 +2155,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
// move the workspace
pWorkspace->m_monitor = pMonitor;
- pWorkspace->m_events.monitorChange.emit();
+ pWorkspace->m_events.monitorChanged.emit();
for (auto const& w : m_windows) {
if (w->m_workspace == pWorkspace) {
@@ -2227,9 +2204,9 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo
pMonitor->m_activeWorkspace = pWorkspace;
if (oldWorkspace)
- oldWorkspace->m_events.activeChange.emit();
+ oldWorkspace->m_events.activeChanged.emit();
- pWorkspace->m_events.activeChange.emit();
+ pWorkspace->m_events.activeChanged.emit();
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->m_id);
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 135b06a3..36ec030b 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -59,10 +59,10 @@ void CLayerSurface::registerCallbacks() {
}
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : m_layerSurface(resource_) {
- m_listeners.commit = m_layerSurface->m_events.commit.registerListener([this](std::any d) { onCommit(); });
- m_listeners.map = m_layerSurface->m_events.map.registerListener([this](std::any d) { onMap(); });
- m_listeners.unmap = m_layerSurface->m_events.unmap.registerListener([this](std::any d) { onUnmap(); });
- m_listeners.destroy = m_layerSurface->m_events.destroy.registerListener([this](std::any d) { onDestroy(); });
+ m_listeners.commit = m_layerSurface->m_events.commit.listen([this] { onCommit(); });
+ m_listeners.map = m_layerSurface->m_events.map.listen([this] { onMap(); });
+ m_listeners.unmap = m_layerSurface->m_events.unmap.listen([this] { onUnmap(); });
+ m_listeners.destroy = m_layerSurface->m_events.destroy.listen([this] { onDestroy(); });
m_surface = CWLSurface::create();
}
diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp
index b647bed5..702ebdf9 100644
--- a/src/desktop/Popup.cpp
+++ b/src/desktop/Popup.cpp
@@ -53,24 +53,22 @@ void CPopup::initAllSignals() {
if (!m_resource) {
if (!m_windowOwner.expired())
- m_listeners.newPopup =
- m_windowOwner->m_xdgSurface->m_events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
+ m_listeners.newPopup = m_windowOwner->m_xdgSurface->m_events.newPopup.listen([this](const auto& resource) { this->onNewPopup(resource); });
else if (!m_layerOwner.expired())
- m_listeners.newPopup =
- m_layerOwner->m_layerSurface->m_events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
+ m_listeners.newPopup = m_layerOwner->m_layerSurface->m_events.newPopup.listen([this](const auto& resource) { this->onNewPopup(resource); });
else
ASSERT(false);
return;
}
- m_listeners.reposition = m_resource->m_events.reposition.registerListener([this](std::any d) { this->onReposition(); });
- m_listeners.map = m_resource->m_surface->m_events.map.registerListener([this](std::any d) { this->onMap(); });
- m_listeners.unmap = m_resource->m_surface->m_events.unmap.registerListener([this](std::any d) { this->onUnmap(); });
- m_listeners.dismissed = m_resource->m_events.dismissed.registerListener([this](std::any d) { this->onUnmap(); });
- m_listeners.destroy = m_resource->m_surface->m_events.destroy.registerListener([this](std::any d) { this->onDestroy(); });
- m_listeners.commit = m_resource->m_surface->m_events.commit.registerListener([this](std::any d) { this->onCommit(); });
- m_listeners.newPopup = m_resource->m_surface->m_events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
+ m_listeners.reposition = m_resource->m_events.reposition.listen([this] { this->onReposition(); });
+ m_listeners.map = m_resource->m_surface->m_events.map.listen([this] { this->onMap(); });
+ m_listeners.unmap = m_resource->m_surface->m_events.unmap.listen([this] { this->onUnmap(); });
+ m_listeners.dismissed = m_resource->m_events.dismissed.listen([this] { this->onUnmap(); });
+ m_listeners.destroy = m_resource->m_surface->m_events.destroy.listen([this] { this->onDestroy(); });
+ m_listeners.commit = m_resource->m_surface->m_events.commit.listen([this] { this->onCommit(); });
+ m_listeners.newPopup = m_resource->m_surface->m_events.newPopup.listen([this](const auto& resource) { this->onNewPopup(resource); });
}
void CPopup::onNewPopup(SP<CXDGPopupResource> popup) {
diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp
index 1c5d5c70..d13a1344 100644
--- a/src/desktop/Subsurface.cpp
+++ b/src/desktop/Subsurface.cpp
@@ -52,19 +52,16 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CP
void CSubsurface::initSignals() {
if (m_subsurface) {
- m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.registerListener([this](std::any d) { onCommit(); });
- m_listeners.destroySubsurface = m_subsurface->m_events.destroy.registerListener([this](std::any d) { onDestroy(); });
- m_listeners.mapSubsurface = m_subsurface->m_surface->m_events.map.registerListener([this](std::any d) { onMap(); });
- m_listeners.unmapSubsurface = m_subsurface->m_surface->m_events.unmap.registerListener([this](std::any d) { onUnmap(); });
- m_listeners.newSubsurface =
- m_subsurface->m_surface->m_events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
+ m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.listen([this] { onCommit(); });
+ m_listeners.destroySubsurface = m_subsurface->m_events.destroy.listen([this] { onDestroy(); });
+ m_listeners.mapSubsurface = m_subsurface->m_surface->m_events.map.listen([this] { onMap(); });
+ m_listeners.unmapSubsurface = m_subsurface->m_surface->m_events.unmap.listen([this] { onUnmap(); });
+ m_listeners.newSubsurface = m_subsurface->m_surface->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
} else {
if (m_windowParent)
- m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener(
- [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
+ m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
else if (m_popupParent)
- m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener(
- [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
+ m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
else
ASSERT(false);
}
diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp
index a7b9e620..d1483db2 100644
--- a/src/desktop/WLSurface.cpp
+++ b/src/desktop/WLSurface.cpp
@@ -159,7 +159,7 @@ void CWLSurface::init() {
m_resource->m_hlSurface = m_self.lock();
- m_listeners.destroy = m_resource->m_events.destroy.registerListener([this](std::any d) { destroy(); });
+ m_listeners.destroy = m_resource->m_events.destroy.listen([this] { destroy(); });
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
}
diff --git a/src/desktop/WLSurface.hpp b/src/desktop/WLSurface.hpp
index d0da546c..3aed5046 100644
--- a/src/desktop/WLSurface.hpp
+++ b/src/desktop/WLSurface.hpp
@@ -91,7 +91,7 @@ class CWLSurface {
CRegion m_visibleRegion;
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
WP<CWLSurface> m_self;
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index a7b0cdab..8cdb5ceb 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -89,30 +89,30 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
CWindow::CWindow(SP<CXDGSurfaceResource> resource) : m_xdgSurface(resource) {
m_wlSurface = CWLSurface::create();
- m_listeners.map = m_xdgSurface->m_events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); });
- m_listeners.ack = m_xdgSurface->m_events.ack.registerListener([this](std::any d) { onAck(std::any_cast<uint32_t>(d)); });
- m_listeners.unmap = m_xdgSurface->m_events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); });
- m_listeners.destroy = m_xdgSurface->m_events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); });
- m_listeners.commit = m_xdgSurface->m_events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); });
- m_listeners.updateState = m_xdgSurface->m_toplevel->m_events.stateChanged.registerListener([this](std::any d) { onUpdateState(); });
- m_listeners.updateMetadata = m_xdgSurface->m_toplevel->m_events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); });
+ m_listeners.map = m_xdgSurface->m_events.map.listen([this] { Events::listener_mapWindow(this, nullptr); });
+ m_listeners.ack = m_xdgSurface->m_events.ack.listen([this](uint32_t d) { onAck(d); });
+ m_listeners.unmap = m_xdgSurface->m_events.unmap.listen([this] { Events::listener_unmapWindow(this, nullptr); });
+ m_listeners.destroy = m_xdgSurface->m_events.destroy.listen([this] { Events::listener_destroyWindow(this, nullptr); });
+ m_listeners.commit = m_xdgSurface->m_events.commit.listen([this] { Events::listener_commitWindow(this, nullptr); });
+ m_listeners.updateState = m_xdgSurface->m_toplevel->m_events.stateChanged.listen([this] { onUpdateState(); });
+ m_listeners.updateMetadata = m_xdgSurface->m_toplevel->m_events.metadataChanged.listen([this] { onUpdateMeta(); });
}
CWindow::CWindow(SP<CXWaylandSurface> surface) : m_xwaylandSurface(surface) {
m_wlSurface = CWLSurface::create();
- m_listeners.map = m_xwaylandSurface->m_events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); });
- m_listeners.unmap = m_xwaylandSurface->m_events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); });
- m_listeners.destroy = m_xwaylandSurface->m_events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); });
- m_listeners.commit = m_xwaylandSurface->m_events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); });
- m_listeners.configureRequest = m_xwaylandSurface->m_events.configureRequest.registerListener([this](std::any d) { onX11ConfigureRequest(std::any_cast<CBox>(d)); });
- m_listeners.updateState = m_xwaylandSurface->m_events.stateChanged.registerListener([this](std::any d) { onUpdateState(); });
- m_listeners.updateMetadata = m_xwaylandSurface->m_events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); });
- m_listeners.resourceChange = m_xwaylandSurface->m_events.resourceChange.registerListener([this](std::any d) { onResourceChangeX11(); });
- m_listeners.activate = m_xwaylandSurface->m_events.activate.registerListener([this](std::any d) { Events::listener_activateX11(this, nullptr); });
+ m_listeners.map = m_xwaylandSurface->m_events.map.listen([this] { Events::listener_mapWindow(this, nullptr); });
+ m_listeners.unmap = m_xwaylandSurface->m_events.unmap.listen([this] { Events::listener_unmapWindow(this, nullptr); });
+ m_listeners.destroy = m_xwaylandSurface->m_events.destroy.listen([this] { Events::listener_destroyWindow(this, nullptr); });
+ m_listeners.commit = m_xwaylandSurface->m_events.commit.listen([this] { Events::listener_commitWindow(this, nullptr); });
+ m_listeners.configureRequest = m_xwaylandSurface->m_events.configureRequest.listen([this](const CBox& box) { onX11ConfigureRequest(box); });
+ m_listeners.updateState = m_xwaylandSurface->m_events.stateChanged.listen([this] { onUpdateState(); });
+ m_listeners.updateMetadata = m_xwaylandSurface->m_events.metadataChanged.listen([this] { onUpdateMeta(); });
+ m_listeners.resourceChange = m_xwaylandSurface->m_events.resourceChange.listen([this] { onResourceChangeX11(); });
+ m_listeners.activate = m_xwaylandSurface->m_events.activate.listen([this] { Events::listener_activateX11(this, nullptr); });
if (m_xwaylandSurface->m_overrideRedirect)
- m_listeners.setGeometry = m_xwaylandSurface->m_events.setGeometry.registerListener([this](std::any d) { Events::listener_unmanagedSetGeometry(this, nullptr); });
+ m_listeners.setGeometry = m_xwaylandSurface->m_events.setGeometry.listen([this] { Events::listener_unmanagedSetGeometry(this, nullptr); });
}
CWindow::~CWindow() {
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index 3f73c468..1c4d3c67 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -148,7 +148,7 @@ class CWindow {
SP<CWLSurface> m_wlSurface;
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
WP<CXDGSurfaceResource> m_xdgSurface;
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 1e5fbfa6..b6320f05 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -644,7 +644,7 @@ void CWorkspace::rename(const std::string& name) {
g_pCompositor->ensurePersistentWorkspacesPresent(std::vector<SWorkspaceRule>{WORKSPACERULE}, m_self.lock());
g_pEventManager->postEvent({.event = "renameworkspace", .data = std::to_string(m_id) + "," + m_name});
- m_events.rename.emit();
+ m_events.renamed.emit();
}
void CWorkspace::updateWindows() {
diff --git a/src/desktop/Workspace.hpp b/src/desktop/Workspace.hpp
index 5bf38489..fa23966b 100644
--- a/src/desktop/Workspace.hpp
+++ b/src/desktop/Workspace.hpp
@@ -85,10 +85,10 @@ class CWorkspace {
void updateWindows();
struct {
- CSignal destroy;
- CSignal rename;
- CSignal monitorChange;
- CSignal activeChange;
+ CSignalT<> destroy;
+ CSignalT<> renamed;
+ CSignalT<> monitorChanged;
+ CSignalT<> activeChanged;
} m_events;
private:
diff --git a/src/devices/IHID.hpp b/src/devices/IHID.hpp
index 4de5abe6..c57778ff 100644
--- a/src/devices/IHID.hpp
+++ b/src/devices/IHID.hpp
@@ -33,9 +33,9 @@ class IHID {
virtual eHIDType getType();
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
std::string m_deviceName;
std::string m_hlName;
-}; \ No newline at end of file
+};
diff --git a/src/devices/IKeyboard.hpp b/src/devices/IKeyboard.hpp
index c66aee27..25a7efd1 100644
--- a/src/devices/IKeyboard.hpp
+++ b/src/devices/IKeyboard.hpp
@@ -48,10 +48,10 @@ class IKeyboard : public IHID {
};
struct {
- CSignal key;
- CSignal modifiers;
- CSignal keymap;
- CSignal repeatInfo;
+ CSignalT<SKeyEvent> key;
+ CSignalT<SModifiersEvent> modifiers;
+ CSignalT<SKeymapEvent> keymap;
+ CSignalT<> repeatInfo;
} m_keyboardEvents;
struct SStringRuleNames {
diff --git a/src/devices/IPointer.hpp b/src/devices/IPointer.hpp
index 993095e0..e5d76344 100644
--- a/src/devices/IPointer.hpp
+++ b/src/devices/IPointer.hpp
@@ -90,22 +90,22 @@ class IPointer : public IHID {
};
struct {
- CSignal motion;
- CSignal motionAbsolute;
- CSignal button;
- CSignal axis;
- CSignal frame;
-
- CSignal swipeBegin;
- CSignal swipeEnd;
- CSignal swipeUpdate;
-
- CSignal pinchBegin;
- CSignal pinchEnd;
- CSignal pinchUpdate;
-
- CSignal holdBegin;
- CSignal holdEnd;
+ CSignalT<SMotionEvent> motion;
+ CSignalT<SMotionAbsoluteEvent> motionAbsolute;
+ CSignalT<SButtonEvent> button;
+ CSignalT<SAxisEvent> axis;
+ CSignalT<> frame;
+
+ CSignalT<SSwipeBeginEvent> swipeBegin;
+ CSignalT<SSwipeEndEvent> swipeEnd;
+ CSignalT<SSwipeUpdateEvent> swipeUpdate;
+
+ CSignalT<SPinchBeginEvent> pinchBegin;
+ CSignalT<SPinchEndEvent> pinchEnd;
+ CSignalT<SPinchUpdateEvent> pinchUpdate;
+
+ CSignalT<SHoldBeginEvent> holdBegin;
+ CSignalT<SHoldEndEvent> holdEnd;
} m_pointerEvents;
bool m_connected = false; // means connected to the cursor
diff --git a/src/devices/ITouch.hpp b/src/devices/ITouch.hpp
index e5230394..14803011 100644
--- a/src/devices/ITouch.hpp
+++ b/src/devices/ITouch.hpp
@@ -37,14 +37,14 @@ class ITouch : public IHID {
};
struct {
- CSignal down;
- CSignal up;
- CSignal motion;
- CSignal cancel;
- CSignal frame;
+ CSignalT<SDownEvent> down;
+ CSignalT<SUpEvent> up;
+ CSignalT<SMotionEvent> motion;
+ CSignalT<SCancelEvent> cancel;
+ CSignalT<> frame;
} m_touchEvents;
std::string m_boundOutput = "";
WP<ITouch> m_self;
-}; \ No newline at end of file
+};
diff --git a/src/devices/Keyboard.cpp b/src/devices/Keyboard.cpp
index 70abe54d..9ce37e6b 100644
--- a/src/devices/Keyboard.cpp
+++ b/src/devices/Keyboard.cpp
@@ -23,24 +23,22 @@ CKeyboard::CKeyboard(SP<Aquamarine::IKeyboard> keeb) : m_keyboard(keeb) {
if (!keeb)
return;
- m_listeners.destroy = keeb->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = keeb->events.destroy.listen([this] {
m_keyboard.reset();
m_events.destroy.emit();
});
- m_listeners.key = keeb->events.key.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IKeyboard::SKeyEvent>(d);
-
+ m_listeners.key = keeb->events.key.listen([this](const Aquamarine::IKeyboard::SKeyEvent& event) {
m_keyboardEvents.key.emit(SKeyEvent{
- .timeMs = E.timeMs,
- .keycode = E.key,
- .state = E.pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED,
+ .timeMs = event.timeMs,
+ .keycode = event.key,
+ .state = event.pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED,
});
- updateXkbStateWithKey(E.key + 8, E.pressed);
+ updateXkbStateWithKey(event.key + 8, event.pressed);
});
- m_listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) {
+ m_listeners.modifiers = keeb->events.modifiers.listen([this] {
updateModifiersState();
m_keyboardEvents.modifiers.emit(SModifiersEvent{
diff --git a/src/devices/Mouse.cpp b/src/devices/Mouse.cpp
index 539aecf7..b9cf9ffc 100644
--- a/src/devices/Mouse.cpp
+++ b/src/devices/Mouse.cpp
@@ -19,133 +19,109 @@ CMouse::CMouse(SP<Aquamarine::IPointer> mouse_) : m_mouse(mouse_) {
m_isTouchpad = libinput_device_has_capability(handle, LIBINPUT_DEVICE_CAP_POINTER) && libinput_device_get_size(handle, &w, &h) == 0;
}
- m_listeners.destroy = m_mouse->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_mouse->events.destroy.listen([this] {
m_mouse.reset();
m_events.destroy.emit();
});
- m_listeners.motion = m_mouse->events.move.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SMoveEvent>(d);
-
+ m_listeners.motion = m_mouse->events.move.listen([this](const Aquamarine::IPointer::SMoveEvent& event) {
m_pointerEvents.motion.emit(SMotionEvent{
- .timeMs = E.timeMs,
- .delta = E.delta,
- .unaccel = E.unaccel,
+ .timeMs = event.timeMs,
+ .delta = event.delta,
+ .unaccel = event.unaccel,
.mouse = true,
.device = m_self.lock(),
});
});
- m_listeners.motionAbsolute = m_mouse->events.warp.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SWarpEvent>(d);
-
+ m_listeners.motionAbsolute = m_mouse->events.warp.listen([this](const Aquamarine::IPointer::SWarpEvent& event) {
m_pointerEvents.motionAbsolute.emit(SMotionAbsoluteEvent{
- .timeMs = E.timeMs,
- .absolute = E.absolute,
+ .timeMs = event.timeMs,
+ .absolute = event.absolute,
.device = m_self.lock(),
});
});
- m_listeners.button = m_mouse->events.button.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SButtonEvent>(d);
-
+ m_listeners.button = m_mouse->events.button.listen([this](const Aquamarine::IPointer::SButtonEvent& event) {
m_pointerEvents.button.emit(SButtonEvent{
- .timeMs = E.timeMs,
- .button = E.button,
- .state = E.pressed ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED,
+ .timeMs = event.timeMs,
+ .button = event.button,
+ .state = event.pressed ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED,
.mouse = true,
});
});
- m_listeners.axis = m_mouse->events.axis.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SAxisEvent>(d);
-
+ m_listeners.axis = m_mouse->events.axis.listen([this](const Aquamarine::IPointer::SAxisEvent& event) {
m_pointerEvents.axis.emit(SAxisEvent{
- .timeMs = E.timeMs,
- .source = (wl_pointer_axis_source)E.source,
- .axis = (wl_pointer_axis)E.axis,
- .relativeDirection = (wl_pointer_axis_relative_direction)E.direction,
- .delta = E.delta,
- .deltaDiscrete = E.discrete,
+ .timeMs = event.timeMs,
+ .source = (wl_pointer_axis_source)event.source,
+ .axis = (wl_pointer_axis)event.axis,
+ .relativeDirection = (wl_pointer_axis_relative_direction)event.direction,
+ .delta = event.delta,
+ .deltaDiscrete = event.discrete,
.mouse = true,
});
});
- m_listeners.frame = m_mouse->events.frame.registerListener([this](std::any d) { m_pointerEvents.frame.emit(); });
-
- m_listeners.swipeBegin = m_mouse->events.swipeBegin.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SSwipeBeginEvent>(d);
+ m_listeners.frame = m_mouse->events.frame.listen([this] { m_pointerEvents.frame.emit(); });
+ m_listeners.swipeBegin = m_mouse->events.swipeBegin.listen([this](const Aquamarine::IPointer::SSwipeBeginEvent& event) {
m_pointerEvents.swipeBegin.emit(SSwipeBeginEvent{
- .timeMs = E.timeMs,
- .fingers = E.fingers,
+ .timeMs = event.timeMs,
+ .fingers = event.fingers,
});
});
- m_listeners.swipeEnd = m_mouse->events.swipeEnd.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SSwipeEndEvent>(d);
-
+ m_listeners.swipeEnd = m_mouse->events.swipeEnd.listen([this](const Aquamarine::IPointer::SSwipeEndEvent& event) {
m_pointerEvents.swipeEnd.emit(SSwipeEndEvent{
- .timeMs = E.timeMs,
- .cancelled = E.cancelled,
+ .timeMs = event.timeMs,
+ .cancelled = event.cancelled,
});
});
- m_listeners.swipeUpdate = m_mouse->events.swipeUpdate.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SSwipeUpdateEvent>(d);
-
+ m_listeners.swipeUpdate = m_mouse->events.swipeUpdate.listen([this](const Aquamarine::IPointer::SSwipeUpdateEvent& event) {
m_pointerEvents.swipeUpdate.emit(SSwipeUpdateEvent{
- .timeMs = E.timeMs,
- .fingers = E.fingers,
- .delta = E.delta,
+ .timeMs = event.timeMs,
+ .fingers = event.fingers,
+ .delta = event.delta,
});
});
- m_listeners.pinchBegin = m_mouse->events.pinchBegin.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SPinchBeginEvent>(d);
-
+ m_listeners.pinchBegin = m_mouse->events.pinchBegin.listen([this](const Aquamarine::IPointer::SPinchBeginEvent& event) {
m_pointerEvents.pinchBegin.emit(SPinchBeginEvent{
- .timeMs = E.timeMs,
- .fingers = E.fingers,
+ .timeMs = event.timeMs,
+ .fingers = event.fingers,
});
});
- m_listeners.pinchEnd = m_mouse->events.pinchEnd.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SPinchEndEvent>(d);
-
+ m_listeners.pinchEnd = m_mouse->events.pinchEnd.listen([this](const Aquamarine::IPointer::SPinchEndEvent& event) {
m_pointerEvents.pinchEnd.emit(SPinchEndEvent{
- .timeMs = E.timeMs,
- .cancelled = E.cancelled,
+ .timeMs = event.timeMs,
+ .cancelled = event.cancelled,
});
});
- m_listeners.pinchUpdate = m_mouse->events.pinchUpdate.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SPinchUpdateEvent>(d);
-
+ m_listeners.pinchUpdate = m_mouse->events.pinchUpdate.listen([this](const Aquamarine::IPointer::SPinchUpdateEvent& event) {
m_pointerEvents.pinchUpdate.emit(SPinchUpdateEvent{
- .timeMs = E.timeMs,
- .fingers = E.fingers,
- .delta = E.delta,
- .scale = E.scale,
- .rotation = E.rotation,
+ .timeMs = event.timeMs,
+ .fingers = event.fingers,
+ .delta = event.delta,
+ .scale = event.scale,
+ .rotation = event.rotation,
});
});
- m_listeners.holdBegin = m_mouse->events.holdBegin.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SHoldBeginEvent>(d);
-
+ m_listeners.holdBegin = m_mouse->events.holdBegin.listen([this](const Aquamarine::IPointer::SHoldBeginEvent& event) {
m_pointerEvents.holdBegin.emit(SHoldBeginEvent{
- .timeMs = E.timeMs,
- .fingers = E.fingers,
+ .timeMs = event.timeMs,
+ .fingers = event.fingers,
});
});
- m_listeners.holdEnd = m_mouse->events.holdEnd.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IPointer::SHoldEndEvent>(d);
-
+ m_listeners.holdEnd = m_mouse->events.holdEnd.listen([this](const Aquamarine::IPointer::SHoldEndEvent& event) {
m_pointerEvents.holdEnd.emit(SHoldEndEvent{
- .timeMs = E.timeMs,
- .cancelled = E.cancelled,
+ .timeMs = event.timeMs,
+ .cancelled = event.cancelled,
});
});
diff --git a/src/devices/Tablet.cpp b/src/devices/Tablet.cpp
index faeb3d73..cbda1a71 100644
--- a/src/devices/Tablet.cpp
+++ b/src/devices/Tablet.cpp
@@ -69,63 +69,55 @@ CTablet::CTablet(SP<Aquamarine::ITablet> tablet_) : m_tablet(tablet_) {
if (!m_tablet)
return;
- m_listeners.destroy = m_tablet->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_tablet->events.destroy.listen([this] {
m_tablet.reset();
m_events.destroy.emit();
});
- m_listeners.axis = m_tablet->events.axis.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITablet::SAxisEvent>(d);
-
+ m_listeners.axis = m_tablet->events.axis.listen([this](const Aquamarine::ITablet::SAxisEvent& event) {
m_tabletEvents.axis.emit(SAxisEvent{
- .tool = E.tool,
+ .tool = event.tool,
.tablet = m_self.lock(),
- .timeMs = E.timeMs,
- .updatedAxes = aqUpdateToHl(E.updatedAxes),
- .axis = E.absolute,
- .axisDelta = E.delta,
- .tilt = E.tilt,
- .pressure = E.pressure,
- .distance = E.distance,
- .rotation = E.rotation,
- .slider = E.slider,
- .wheelDelta = E.wheelDelta,
+ .timeMs = event.timeMs,
+ .updatedAxes = aqUpdateToHl(event.updatedAxes),
+ .axis = event.absolute,
+ .axisDelta = event.delta,
+ .tilt = event.tilt,
+ .pressure = event.pressure,
+ .distance = event.distance,
+ .rotation = event.rotation,
+ .slider = event.slider,
+ .wheelDelta = event.wheelDelta,
});
});
- m_listeners.proximity = m_tablet->events.proximity.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITablet::SProximityEvent>(d);
-
+ m_listeners.proximity = m_tablet->events.proximity.listen([this](const Aquamarine::ITablet::SProximityEvent& event) {
m_tabletEvents.proximity.emit(SProximityEvent{
- .tool = E.tool,
+ .tool = event.tool,
.tablet = m_self.lock(),
- .timeMs = E.timeMs,
- .proximity = E.absolute,
- .in = E.in,
+ .timeMs = event.timeMs,
+ .proximity = event.absolute,
+ .in = event.in,
});
});
- m_listeners.tip = m_tablet->events.tip.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITablet::STipEvent>(d);
-
+ m_listeners.tip = m_tablet->events.tip.listen([this](const Aquamarine::ITablet::STipEvent& event) {
m_tabletEvents.tip.emit(STipEvent{
- .tool = E.tool,
+ .tool = event.tool,
.tablet = m_self.lock(),
- .timeMs = E.timeMs,
- .tip = E.absolute,
- .in = E.down,
+ .timeMs = event.timeMs,
+ .tip = event.absolute,
+ .in = event.down,
});
});
- m_listeners.button = m_tablet->events.button.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITablet::SButtonEvent>(d);
-
+ m_listeners.button = m_tablet->events.button.listen([this](const Aquamarine::ITablet::SButtonEvent& event) {
m_tabletEvents.button.emit(SButtonEvent{
- .tool = E.tool,
+ .tool = event.tool,
.tablet = m_self.lock(),
- .timeMs = E.timeMs,
- .button = E.button,
- .down = E.down,
+ .timeMs = event.timeMs,
+ .button = event.button,
+ .down = event.down,
});
});
@@ -156,48 +148,42 @@ CTabletPad::CTabletPad(SP<Aquamarine::ITabletPad> pad_) : m_pad(pad_) {
if (!m_pad)
return;
- m_listeners.destroy = m_pad->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_pad->events.destroy.listen([this] {
m_pad.reset();
m_events.destroy.emit();
});
- m_listeners.button = m_pad->events.button.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITabletPad::SButtonEvent>(d);
-
+ m_listeners.button = m_pad->events.button.listen([this](const Aquamarine::ITabletPad::SButtonEvent& event) {
m_padEvents.button.emit(SButtonEvent{
- .timeMs = E.timeMs,
- .button = E.button,
- .down = E.down,
- .mode = E.mode,
- .group = E.group,
+ .timeMs = event.timeMs,
+ .button = event.button,
+ .down = event.down,
+ .mode = event.mode,
+ .group = event.group,
});
});
- m_listeners.ring = m_pad->events.ring.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITabletPad::SRingEvent>(d);
-
+ m_listeners.ring = m_pad->events.ring.listen([this](const Aquamarine::ITabletPad::SRingEvent& event) {
m_padEvents.ring.emit(SRingEvent{
- .timeMs = E.timeMs,
- .finger = E.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_RING_SOURCE_FINGER,
- .ring = E.ring,
- .position = E.pos,
- .mode = E.mode,
+ .timeMs = event.timeMs,
+ .finger = event.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_RING_SOURCE_FINGER,
+ .ring = event.ring,
+ .position = event.pos,
+ .mode = event.mode,
});
});
- m_listeners.strip = m_pad->events.strip.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITabletPad::SStripEvent>(d);
-
+ m_listeners.strip = m_pad->events.strip.listen([this](const Aquamarine::ITabletPad::SStripEvent& event) {
m_padEvents.strip.emit(SStripEvent{
- .timeMs = E.timeMs,
- .finger = E.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_STRIP_SOURCE_FINGER,
- .strip = E.strip,
- .position = E.pos,
- .mode = E.mode,
+ .timeMs = event.timeMs,
+ .finger = event.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_STRIP_SOURCE_FINGER,
+ .strip = event.strip,
+ .position = event.pos,
+ .mode = event.mode,
});
});
- m_listeners.attach = m_pad->events.attach.registerListener([](std::any d) {
+ m_listeners.attach = m_pad->events.attach.listen([] {
; // TODO: this doesn't do anything in aq atm
});
@@ -224,7 +210,7 @@ CTabletTool::CTabletTool(SP<Aquamarine::ITabletTool> tool_) : m_tool(tool_) {
if (!m_tool)
return;
- m_listeners.destroyTool = m_tool->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroyTool = m_tool->events.destroy.listen([this] {
m_tool.reset();
m_events.destroy.emit();
});
@@ -265,7 +251,7 @@ void CTabletTool::setSurface(SP<CWLSurfaceResource> surf) {
m_surface = surf;
if (surf) {
- m_listeners.destroySurface = surf->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = surf->m_events.destroy.listen([this] {
PROTO::tablet->proximityOut(m_self.lock());
m_surface.reset();
m_listeners.destroySurface.reset();
diff --git a/src/devices/Tablet.hpp b/src/devices/Tablet.hpp
index b98c7f85..b5e55c19 100644
--- a/src/devices/Tablet.hpp
+++ b/src/devices/Tablet.hpp
@@ -82,10 +82,10 @@ class CTablet : public IHID {
};
struct {
- CSignal axis;
- CSignal proximity;
- CSignal tip;
- CSignal button;
+ CSignalT<SAxisEvent> axis;
+ CSignalT<SProximityEvent> proximity;
+ CSignalT<STipEvent> tip;
+ CSignalT<SButtonEvent> button;
} m_tabletEvents;
WP<CTablet> m_self;
@@ -144,10 +144,10 @@ class CTabletPad : public IHID {
};
struct {
- CSignal button;
- CSignal ring;
- CSignal strip;
- CSignal attach;
+ CSignalT<SButtonEvent> button;
+ CSignalT<SRingEvent> ring;
+ CSignalT<SStripEvent> strip;
+ CSignalT<SP<CTabletTool>> attach;
} m_padEvents;
WP<CTabletPad> m_self;
@@ -217,4 +217,4 @@ class CTabletTool : public IHID {
CHyprSignalListener destroySurface;
CHyprSignalListener destroyTool;
} m_listeners;
-}; \ No newline at end of file
+};
diff --git a/src/devices/TouchDevice.cpp b/src/devices/TouchDevice.cpp
index c2ff4d6f..527cb02a 100644
--- a/src/devices/TouchDevice.cpp
+++ b/src/devices/TouchDevice.cpp
@@ -14,51 +14,43 @@ CTouchDevice::CTouchDevice(SP<Aquamarine::ITouch> touch_) : m_touch(touch_) {
if (!m_touch)
return;
- m_listeners.destroy = m_touch->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_touch->events.destroy.listen([this] {
m_events.destroy.emit();
m_touch.reset();
});
- m_listeners.down = m_touch->events.down.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITouch::SDownEvent>(d);
-
+ m_listeners.down = m_touch->events.down.listen([this](const Aquamarine::ITouch::SDownEvent& event) {
m_touchEvents.down.emit(SDownEvent{
- .timeMs = E.timeMs,
- .touchID = E.touchID,
- .pos = E.pos,
+ .timeMs = event.timeMs,
+ .touchID = event.touchID,
+ .pos = event.pos,
.device = m_self.lock(),
});
});
- m_listeners.up = m_touch->events.up.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITouch::SUpEvent>(d);
-
+ m_listeners.up = m_touch->events.up.listen([this](const Aquamarine::ITouch::SUpEvent& event) {
m_touchEvents.up.emit(SUpEvent{
- .timeMs = E.timeMs,
- .touchID = E.touchID,
+ .timeMs = event.timeMs,
+ .touchID = event.touchID,
});
});
- m_listeners.motion = m_touch->events.move.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITouch::SMotionEvent>(d);
-
+ m_listeners.motion = m_touch->events.move.listen([this](const Aquamarine::ITouch::SMotionEvent& event) {
m_touchEvents.motion.emit(SMotionEvent{
- .timeMs = E.timeMs,
- .touchID = E.touchID,
- .pos = E.pos,
+ .timeMs = event.timeMs,
+ .touchID = event.touchID,
+ .pos = event.pos,
});
});
- m_listeners.cancel = m_touch->events.cancel.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::ITouch::SCancelEvent>(d);
-
+ m_listeners.cancel = m_touch->events.cancel.listen([this](const Aquamarine::ITouch::SCancelEvent& event) {
m_touchEvents.cancel.emit(SCancelEvent{
- .timeMs = E.timeMs,
- .touchID = E.touchID,
+ .timeMs = event.timeMs,
+ .touchID = event.touchID,
});
});
- m_listeners.frame = m_touch->events.frame.registerListener([this](std::any d) { m_touchEvents.frame.emit(); });
+ m_listeners.frame = m_touch->events.frame.listen([this] { m_touchEvents.frame.emit(); });
m_deviceName = m_touch->getName();
}
diff --git a/src/devices/VirtualKeyboard.cpp b/src/devices/VirtualKeyboard.cpp
index 9952847a..ea21a22b 100644
--- a/src/devices/VirtualKeyboard.cpp
+++ b/src/devices/VirtualKeyboard.cpp
@@ -14,15 +14,14 @@ CVirtualKeyboard::CVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keeb_) : m_key
if (!keeb_)
return;
- m_listeners.destroy = keeb_->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = keeb_->m_events.destroy.listen([this] {
m_keyboard.reset();
m_events.destroy.emit();
});
- m_listeners.key = keeb_->m_events.key.registerListener([this](std::any d) { m_keyboardEvents.key.emit(d); });
- m_listeners.modifiers = keeb_->m_events.modifiers.registerListener([this](std::any d) {
- auto E = std::any_cast<SModifiersEvent>(d);
- updateModifiers(E.depressed, E.latched, E.locked, E.group);
+ m_listeners.key = keeb_->m_events.key.listen([this](const auto& event) { m_keyboardEvents.key.emit(event); });
+ m_listeners.modifiers = keeb_->m_events.modifiers.listen([this](const SModifiersEvent& event) {
+ updateModifiers(event.depressed, event.latched, event.locked, event.group);
m_keyboardEvents.modifiers.emit(SModifiersEvent{
.depressed = m_modifiersState.depressed,
.latched = m_modifiersState.latched,
@@ -30,15 +29,14 @@ CVirtualKeyboard::CVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keeb_) : m_key
.group = m_modifiersState.group,
});
});
- m_listeners.keymap = keeb_->m_events.keymap.registerListener([this](std::any d) {
- auto E = std::any_cast<SKeymapEvent>(d);
+ m_listeners.keymap = keeb_->m_events.keymap.listen([this](const SKeymapEvent& event) {
if (m_xkbKeymap)
xkb_keymap_unref(m_xkbKeymap);
- m_xkbKeymap = xkb_keymap_ref(E.keymap);
+ m_xkbKeymap = xkb_keymap_ref(event.keymap);
m_keymapOverridden = true;
updateXKBTranslationState(m_xkbKeymap);
updateKeymapFD();
- m_keyboardEvents.keymap.emit(d);
+ m_keyboardEvents.keymap.emit(event);
});
m_deviceName = keeb_->m_name;
diff --git a/src/devices/VirtualPointer.cpp b/src/devices/VirtualPointer.cpp
index 2b42b21c..23d860bf 100644
--- a/src/devices/VirtualPointer.cpp
+++ b/src/devices/VirtualPointer.cpp
@@ -14,33 +14,31 @@ CVirtualPointer::CVirtualPointer(SP<CVirtualPointerV1Resource> resource) : m_poi
if UNLIKELY (!resource->good())
return;
- m_listeners.destroy = m_pointer->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_pointer->m_events.destroy.listen([this] {
m_pointer.reset();
m_events.destroy.emit();
});
- m_listeners.motion = m_pointer->m_events.move.registerListener([this](std::any d) {
- auto E = std::any_cast<SMotionEvent>(d);
- E.device = m_self.lock();
- m_pointerEvents.motion.emit(E);
+ m_listeners.motion = m_pointer->m_events.move.listen([this](SMotionEvent event) {
+ event.device = m_self.lock();
+ m_pointerEvents.motion.emit(event);
});
- m_listeners.motionAbsolute = m_pointer->m_events.warp.registerListener([this](std::any d) {
+ m_listeners.motionAbsolute = m_pointer->m_events.warp.listen([this](SMotionAbsoluteEvent event) {
// we need to unpack the event and add our device here because it's required to calculate the position correctly
- auto E = std::any_cast<SMotionAbsoluteEvent>(d);
- E.device = m_self.lock();
- m_pointerEvents.motionAbsolute.emit(E);
+ event.device = m_self.lock();
+ m_pointerEvents.motionAbsolute.emit(event);
});
- m_listeners.button = m_pointer->m_events.button.registerListener([this](std::any d) { m_pointerEvents.button.emit(d); });
- m_listeners.axis = m_pointer->m_events.axis.registerListener([this](std::any d) { m_pointerEvents.axis.emit(d); });
- m_listeners.frame = m_pointer->m_events.frame.registerListener([this](std::any d) { m_pointerEvents.frame.emit(); });
- m_listeners.swipeBegin = m_pointer->m_events.swipeBegin.registerListener([this](std::any d) { m_pointerEvents.swipeBegin.emit(d); });
- m_listeners.swipeEnd = m_pointer->m_events.swipeEnd.registerListener([this](std::any d) { m_pointerEvents.swipeEnd.emit(d); });
- m_listeners.swipeUpdate = m_pointer->m_events.swipeUpdate.registerListener([this](std::any d) { m_pointerEvents.swipeUpdate.emit(d); });
- m_listeners.pinchBegin = m_pointer->m_events.pinchBegin.registerListener([this](std::any d) { m_pointerEvents.pinchBegin.emit(d); });
- m_listeners.pinchEnd = m_pointer->m_events.pinchEnd.registerListener([this](std::any d) { m_pointerEvents.pinchEnd.emit(d); });
- m_listeners.pinchUpdate = m_pointer->m_events.pinchUpdate.registerListener([this](std::any d) { m_pointerEvents.pinchUpdate.emit(d); });
- m_listeners.holdBegin = m_pointer->m_events.holdBegin.registerListener([this](std::any d) { m_pointerEvents.holdBegin.emit(d); });
- m_listeners.holdEnd = m_pointer->m_events.holdEnd.registerListener([this](std::any d) { m_pointerEvents.holdEnd.emit(d); });
+ m_listeners.button = m_pointer->m_events.button.forward(m_pointerEvents.button);
+ m_listeners.axis = m_pointer->m_events.axis.forward(m_pointerEvents.axis);
+ m_listeners.frame = m_pointer->m_events.frame.forward(m_pointerEvents.frame);
+ m_listeners.swipeBegin = m_pointer->m_events.swipeBegin.forward(m_pointerEvents.swipeBegin);
+ m_listeners.swipeEnd = m_pointer->m_events.swipeEnd.forward(m_pointerEvents.swipeEnd);
+ m_listeners.swipeUpdate = m_pointer->m_events.swipeUpdate.forward(m_pointerEvents.swipeUpdate);
+ m_listeners.pinchBegin = m_pointer->m_events.pinchBegin.forward(m_pointerEvents.pinchBegin);
+ m_listeners.pinchEnd = m_pointer->m_events.pinchEnd.forward(m_pointerEvents.pinchEnd);
+ m_listeners.pinchUpdate = m_pointer->m_events.pinchUpdate.forward(m_pointerEvents.pinchUpdate);
+ m_listeners.holdBegin = m_pointer->m_events.holdBegin.forward(m_pointerEvents.holdBegin);
+ m_listeners.holdEnd = m_pointer->m_events.holdEnd.forward(m_pointerEvents.holdEnd);
m_boundOutput = resource->m_boundOutput ? resource->m_boundOutput->m_name : "";
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index e29d9963..7e75b02b 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -68,20 +68,17 @@ void CMonitor::onConnect(bool noRule) {
g_pEventLoopManager->doLater([] { g_pConfigManager->ensurePersistentWorkspacesPresent(); });
- m_listeners.frame = m_output->events.frame.registerListener([this](std::any d) { m_frameScheduler->onFrame(); });
- m_listeners.commit = m_output->events.commit.registerListener([this](std::any d) {
+ m_listeners.frame = m_output->events.frame.listen([this] { m_frameScheduler->onFrame(); });
+ m_listeners.commit = m_output->events.commit.listen([this] {
if (true) { // FIXME: E->state->committed & WLR_OUTPUT_STATE_BUFFER
PROTO::screencopy->onOutputCommit(m_self.lock());
PROTO::toplevelExport->onOutputCommit(m_self.lock());
}
});
- m_listeners.needsFrame =
- m_output->events.needsFrame.registerListener([this](std::any d) { g_pCompositor->scheduleFrameForMonitor(m_self.lock(), Aquamarine::IOutput::AQ_SCHEDULE_NEEDS_FRAME); });
+ m_listeners.needsFrame = m_output->events.needsFrame.listen([this] { g_pCompositor->scheduleFrameForMonitor(m_self.lock(), Aquamarine::IOutput::AQ_SCHEDULE_NEEDS_FRAME); });
- m_listeners.presented = m_output->events.present.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IOutput::SPresentEvent>(d);
-
- timespec* ts = E.when;
+ m_listeners.presented = m_output->events.present.listen([this](const Aquamarine::IOutput::SPresentEvent& event) {
+ timespec* ts = event.when;
if (ts && ts->tv_sec <= 2) {
// drop this timestamp, it's not valid. Likely drm is cringe. We can't push it further because
@@ -90,14 +87,14 @@ void CMonitor::onConnect(bool noRule) {
}
if (!ts)
- PROTO::presentation->onPresented(m_self.lock(), Time::steadyNow(), E.refresh, E.seq, E.flags);
+ PROTO::presentation->onPresented(m_self.lock(), Time::steadyNow(), event.refresh, event.seq, event.flags);
else
- PROTO::presentation->onPresented(m_self.lock(), Time::fromTimespec(E.when), E.refresh, E.seq, E.flags);
+ PROTO::presentation->onPresented(m_self.lock(), Time::fromTimespec(event.when), event.refresh, event.seq, event.flags);
m_frameScheduler->onPresented();
});
- m_listeners.destroy = m_output->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroy = m_output->events.destroy.listen([this] {
Debug::log(LOG, "Destroy called for monitor {}", m_name);
onDisconnect(true);
@@ -110,10 +107,8 @@ void CMonitor::onConnect(bool noRule) {
std::erase_if(g_pCompositor->m_realMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
});
- m_listeners.state = m_output->events.state.registerListener([this](std::any d) {
- auto E = std::any_cast<Aquamarine::IOutput::SStateEvent>(d);
-
- if (E.size == Vector2D{}) {
+ m_listeners.state = m_output->events.state.listen([this](const Aquamarine::IOutput::SStateEvent& event) {
+ if (event.size == Vector2D{}) {
// an indication to re-set state
// we can't do much for createdByUser displays I think
if (m_createdByUser)
@@ -127,7 +122,7 @@ void CMonitor::onConnect(bool noRule) {
if (!m_createdByUser)
return;
- const auto SIZE = E.size;
+ const auto SIZE = event.size;
m_forceSize = SIZE;
@@ -1034,7 +1029,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
m_activeWorkspace = PNEWWORKSPACE;
- PNEWWORKSPACE->m_events.activeChange.emit();
+ PNEWWORKSPACE->m_events.activeChanged.emit();
PNEWWORKSPACE->m_visible = true;
PNEWWORKSPACE->m_lastMonitor = "";
}
@@ -1195,7 +1190,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
if (POLDWORKSPACE) {
POLDWORKSPACE->m_visible = false;
- POLDWORKSPACE->m_events.activeChange.emit();
+ POLDWORKSPACE->m_events.activeChanged.emit();
}
pWorkspace->m_visible = true;
@@ -1241,7 +1236,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
EMIT_HOOK_EVENT("workspace", pWorkspace);
}
- pWorkspace->m_events.activeChange.emit();
+ pWorkspace->m_events.activeChanged.emit();
g_pHyprRenderer->damageMonitor(m_self.lock());
@@ -1281,7 +1276,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
m_activeSpecialWorkspace.reset();
if (POLDSPECIAL)
- POLDSPECIAL->m_events.activeChange.emit();
+ POLDSPECIAL->m_events.activeChanged.emit();
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id);
@@ -1327,13 +1322,13 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
m_activeSpecialWorkspace->m_visible = true;
if (POLDSPECIAL)
- POLDSPECIAL->m_events.activeChange.emit();
+ POLDSPECIAL->m_events.activeChanged.emit();
if (PMONITORWORKSPACEOWNER != m_self)
- pWorkspace->m_events.monitorChange.emit();
+ pWorkspace->m_events.monitorChanged.emit();
if (!wasActive)
- pWorkspace->m_events.activeChange.emit();
+ pWorkspace->m_events.activeChanged.emit();
if (!wasActive)
pWorkspace->startAnim(true, true);
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index 1cde19f1..86ab8b76 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -194,11 +194,11 @@ class CMonitor {
} m_tearingState;
struct {
- CSignal destroy;
- CSignal connect;
- CSignal disconnect;
- CSignal dpmsChanged;
- CSignal modeChanged;
+ CSignalT<> destroy;
+ CSignalT<> connect;
+ CSignalT<> disconnect;
+ CSignalT<> dpmsChanged;
+ CSignalT<> modeChanged;
} m_events;
std::array<std::vector<PHLLSREF>, 4> m_layerSurfaceLayers;
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp
index e4455486..f6b08f1b 100644
--- a/src/managers/PointerManager.cpp
+++ b/src/managers/PointerManager.cpp
@@ -29,14 +29,12 @@ CPointerManager::CPointerManager() {
onMonitorLayoutChange();
- PMONITOR->m_events.modeChanged.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr);
- PMONITOR->m_events.disconnect.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr);
- PMONITOR->m_events.destroy.registerStaticListener(
- [this](void* owner, std::any data) {
- if (g_pCompositor && !g_pCompositor->m_isShuttingDown)
- std::erase_if(m_monitorStates, [](const auto& other) { return other->monitor.expired(); });
- },
- nullptr);
+ PMONITOR->m_events.modeChanged.listenStatic([this] { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); });
+ PMONITOR->m_events.disconnect.listenStatic([this] { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); });
+ PMONITOR->m_events.destroy.listenStatic([this] {
+ if (g_pCompositor && !g_pCompositor->m_isShuttingDown)
+ std::erase_if(m_monitorStates, [](const auto& other) { return other->monitor.expired(); });
+ });
});
m_hooks.monitorPreRender = g_pHookSystem->hookDynamic("preMonitorCommit", [this](void* self, SCallbackInfo& info, std::any data) {
@@ -149,8 +147,8 @@ void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hots
surf->resource()->map();
- m_currentCursorImage.destroySurface = surf->m_events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
- m_currentCursorImage.commitSurface = surf->resource()->m_events.commit.registerListener([this](std::any data) {
+ m_currentCursorImage.destroySurface = surf->m_events.destroy.listen([this] { resetCursorImage(); });
+ m_currentCursorImage.commitSurface = surf->resource()->m_events.commit.listen([this] {
damageIfSoftware();
m_currentCursorImage.size = m_currentCursorImage.surface->resource()->m_current.texture ? m_currentCursorImage.surface->resource()->m_current.bufferSize : Vector2D{};
m_currentCursorImage.scale = m_currentCursorImage.surface ? m_currentCursorImage.surface->resource()->m_current.scale : 1.F;
@@ -898,15 +896,9 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
listener->pointer = pointer;
- // clang-format off
- listener->destroy = pointer->m_events.destroy.registerListener([this] (std::any d) {
- detachPointer(nullptr);
- });
-
- listener->motion = pointer->m_pointerEvents.motion.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SMotionEvent>(e);
-
- g_pInputManager->onMouseMoved(E);
+ listener->destroy = pointer->m_events.destroy.listen([this] { detachPointer(nullptr); });
+ listener->motion = pointer->m_pointerEvents.motion.listen([](const IPointer::SMotionEvent& event) {
+ g_pInputManager->onMouseMoved(event);
PROTO::idle->onActivity();
@@ -914,10 +906,8 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
g_pKeybindManager->dpms("on");
});
- listener->motionAbsolute = pointer->m_pointerEvents.motionAbsolute.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SMotionAbsoluteEvent>(e);
-
- g_pInputManager->onMouseWarp(E);
+ listener->motionAbsolute = pointer->m_pointerEvents.motionAbsolute.listen([](const IPointer::SMotionAbsoluteEvent& event) {
+ g_pInputManager->onMouseWarp(event);
PROTO::idle->onActivity();
@@ -925,37 +915,29 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
g_pKeybindManager->dpms("on");
});
- listener->button = pointer->m_pointerEvents.button.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SButtonEvent>(e);
-
- g_pInputManager->onMouseButton(E);
-
+ listener->button = pointer->m_pointerEvents.button.listen([](const IPointer::SButtonEvent& event) {
+ g_pInputManager->onMouseButton(event);
PROTO::idle->onActivity();
});
- listener->axis = pointer->m_pointerEvents.axis.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SAxisEvent>(e);
-
- g_pInputManager->onMouseWheel(E);
-
+ listener->axis = pointer->m_pointerEvents.axis.listen([](const IPointer::SAxisEvent& event) {
+ g_pInputManager->onMouseWheel(event);
PROTO::idle->onActivity();
});
- listener->frame = pointer->m_pointerEvents.frame.registerListener([] (std::any e) {
+ listener->frame = pointer->m_pointerEvents.frame.listen([] {
bool shouldSkip = false;
if (!g_pSeatManager->m_mouse.expired() && g_pInputManager->isLocked()) {
auto PMONITOR = g_pCompositor->m_lastMonitor.get();
- shouldSkip = PMONITOR && PMONITOR->shouldSkipScheduleFrameOnMouseEvent();
+ shouldSkip = PMONITOR && PMONITOR->shouldSkipScheduleFrameOnMouseEvent();
}
g_pSeatManager->m_isPointerFrameSkipped = shouldSkip;
if (!g_pSeatManager->m_isPointerFrameSkipped)
g_pSeatManager->sendPointerFrame();
});
- listener->swipeBegin = pointer->m_pointerEvents.swipeBegin.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SSwipeBeginEvent>(e);
-
- g_pInputManager->onSwipeBegin(E);
+ listener->swipeBegin = pointer->m_pointerEvents.swipeBegin.listen([](const IPointer::SSwipeBeginEvent& event) {
+ g_pInputManager->onSwipeBegin(event);
PROTO::idle->onActivity();
@@ -963,26 +945,18 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
g_pKeybindManager->dpms("on");
});
- listener->swipeEnd = pointer->m_pointerEvents.swipeEnd.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SSwipeEndEvent>(e);
-
- g_pInputManager->onSwipeEnd(E);
-
+ listener->swipeEnd = pointer->m_pointerEvents.swipeEnd.listen([](const IPointer::SSwipeEndEvent& event) {
+ g_pInputManager->onSwipeEnd(event);
PROTO::idle->onActivity();
});
- listener->swipeUpdate = pointer->m_pointerEvents.swipeUpdate.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SSwipeUpdateEvent>(e);
-
- g_pInputManager->onSwipeUpdate(E);
-
+ listener->swipeUpdate = pointer->m_pointerEvents.swipeUpdate.listen([](const IPointer::SSwipeUpdateEvent& event) {
+ g_pInputManager->onSwipeUpdate(event);
PROTO::idle->onActivity();
});
- listener->pinchBegin = pointer->m_pointerEvents.pinchBegin.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SPinchBeginEvent>(e);
-
- PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers);
+ listener->pinchBegin = pointer->m_pointerEvents.pinchBegin.listen([](const IPointer::SPinchBeginEvent& event) {
+ PROTO::pointerGestures->pinchBegin(event.timeMs, event.fingers);
PROTO::idle->onActivity();
@@ -990,38 +964,25 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
g_pKeybindManager->dpms("on");
});
- listener->pinchEnd = pointer->m_pointerEvents.pinchEnd.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SPinchEndEvent>(e);
-
- PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled);
-
+ listener->pinchEnd = pointer->m_pointerEvents.pinchEnd.listen([](const IPointer::SPinchEndEvent& event) {
+ PROTO::pointerGestures->pinchEnd(event.timeMs, event.cancelled);
PROTO::idle->onActivity();
});
- listener->pinchUpdate = pointer->m_pointerEvents.pinchUpdate.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SPinchUpdateEvent>(e);
-
- PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation);
-
+ listener->pinchUpdate = pointer->m_pointerEvents.pinchUpdate.listen([](const IPointer::SPinchUpdateEvent& event) {
+ PROTO::pointerGestures->pinchUpdate(event.timeMs, event.delta, event.scale, event.rotation);
PROTO::idle->onActivity();
});
- listener->holdBegin = pointer->m_pointerEvents.holdBegin.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SHoldBeginEvent>(e);
-
- PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers);
-
+ listener->holdBegin = pointer->m_pointerEvents.holdBegin.listen([](const IPointer::SHoldBeginEvent& event) {
+ PROTO::pointerGestures->holdBegin(event.timeMs, event.fingers);
PROTO::idle->onActivity();
});
- listener->holdEnd = pointer->m_pointerEvents.holdEnd.registerListener([] (std::any e) {
- auto E = std::any_cast<IPointer::SHoldEndEvent>(e);
-
- PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled);
-
+ listener->holdEnd = pointer->m_pointerEvents.holdEnd.listen([](const IPointer::SHoldEndEvent& event) {
+ PROTO::pointerGestures->holdEnd(event.timeMs, event.cancelled);
PROTO::idle->onActivity();
});
- // clang-format on
Debug::log(LOG, "Attached pointer {} to global", pointer->m_hlName);
}
@@ -1037,15 +998,10 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
listener->touch = touch;
- // clang-format off
- listener->destroy = touch->m_events.destroy.registerListener([this] (std::any d) {
- detachTouch(nullptr);
- });
-
- listener->down = touch->m_touchEvents.down.registerListener([] (std::any e) {
- auto E = std::any_cast<ITouch::SDownEvent>(e);
+ listener->destroy = touch->m_events.destroy.listen([this] { detachTouch(nullptr); });
- g_pInputManager->onTouchDown(E);
+ listener->down = touch->m_touchEvents.down.listen([](const ITouch::SDownEvent& event) {
+ g_pInputManager->onTouchDown(event);
PROTO::idle->onActivity();
@@ -1053,30 +1009,21 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
g_pKeybindManager->dpms("on");
});
- listener->up = touch->m_touchEvents.up.registerListener([] (std::any e) {
- auto E = std::any_cast<ITouch::SUpEvent>(e);
-
- g_pInputManager->onTouchUp(E);
-
+ listener->up = touch->m_touchEvents.up.listen([](const ITouch::SUpEvent& event) {
+ g_pInputManager->onTouchUp(event);
PROTO::idle->onActivity();
});
- listener->motion = touch->m_touchEvents.motion.registerListener([] (std::any e) {
- auto E = std::any_cast<ITouch::SMotionEvent>(e);
-
- g_pInputManager->onTouchMove(E);
-
+ listener->motion = touch->m_touchEvents.motion.listen([](const ITouch::SMotionEvent& event) {
+ g_pInputManager->onTouchMove(event);
PROTO::idle->onActivity();
});
- listener->cancel = touch->m_touchEvents.cancel.registerListener([] (std::any e) {
+ listener->cancel = touch->m_touchEvents.cancel.listen([] {
//
});
- listener->frame = touch->m_touchEvents.frame.registerListener([] (std::any e) {
- g_pSeatManager->sendTouchFrame();
- });
- // clang-format on
+ listener->frame = touch->m_touchEvents.frame.listen([] { g_pSeatManager->sendTouchFrame(); });
Debug::log(LOG, "Attached touch {} to global", touch->m_hlName);
}
@@ -1092,15 +1039,10 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
listener->tablet = tablet;
- // clang-format off
- listener->destroy = tablet->m_events.destroy.registerListener([this] (std::any d) {
- detachTablet(nullptr);
- });
+ listener->destroy = tablet->m_events.destroy.listen([this] { detachTablet(nullptr); });
- listener->axis = tablet->m_tabletEvents.axis.registerListener([] (std::any e) {
- auto E = std::any_cast<CTablet::SAxisEvent>(e);
-
- g_pInputManager->onTabletAxis(E);
+ listener->axis = tablet->m_tabletEvents.axis.listen([](const CTablet::SAxisEvent& event) {
+ g_pInputManager->onTabletAxis(event);
PROTO::idle->onActivity();
@@ -1108,18 +1050,13 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
g_pKeybindManager->dpms("on");
});
- listener->proximity = tablet->m_tabletEvents.proximity.registerListener([] (std::any e) {
- auto E = std::any_cast<CTablet::SProximityEvent>(e);
-
- g_pInputManager->onTabletProximity(E);
-
+ listener->proximity = tablet->m_tabletEvents.proximity.listen([](const CTablet::SProximityEvent& event) {
+ g_pInputManager->onTabletProximity(event);
PROTO::idle->onActivity();
});
- listener->tip = tablet->m_tabletEvents.tip.registerListener([] (std::any e) {
- auto E = std::any_cast<CTablet::STipEvent>(e);
-
- g_pInputManager->onTabletTip(E);
+ listener->tip = tablet->m_tabletEvents.tip.listen([](const CTablet::STipEvent& event) {
+ g_pInputManager->onTabletTip(event);
PROTO::idle->onActivity();
@@ -1127,11 +1064,8 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
g_pKeybindManager->dpms("on");
});
- listener->button = tablet->m_tabletEvents.button.registerListener([] (std::any e) {
- auto E = std::any_cast<CTablet::SButtonEvent>(e);
-
- g_pInputManager->onTabletButton(E);
-
+ listener->button = tablet->m_tabletEvents.button.listen([](const CTablet::SButtonEvent& event) {
+ g_pInputManager->onTabletButton(event);
PROTO::idle->onActivity();
});
// clang-format on
diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp
index e39dcf4e..193b022c 100644
--- a/src/managers/ProtocolManager.cpp
+++ b/src/managers/ProtocolManager.cpp
@@ -122,7 +122,7 @@ CProtocolManager::CProtocolManager() {
PROTO::outputs.emplace(M->m_name, ref);
ref->m_self = ref;
- m_modeChangeListeners[M->m_name] = M->m_events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); });
+ m_modeChangeListeners[M->m_name] = M->m_events.modeChanged.listen([this, M] { onMonitorModeChange(M); });
});
static auto P2 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp
index 9fe2b26b..76217238 100644
--- a/src/managers/SeatManager.cpp
+++ b/src/managers/SeatManager.cpp
@@ -14,12 +14,12 @@
#include <ranges>
CSeatManager::CSeatManager() {
- m_listeners.newSeatResource = PROTO::seat->m_events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast<SP<CWLSeatResource>>(res)); });
+ m_listeners.newSeatResource = PROTO::seat->m_events.newSeatResource.listen([this](const auto& resource) { onNewSeatResource(resource); });
}
CSeatManager::SSeatResourceContainer::SSeatResourceContainer(SP<CWLSeatResource> res) : resource(res) {
- listeners.destroy = res->m_events.destroy.registerListener(
- [this](std::any data) { std::erase_if(g_pSeatManager->m_seatResources, [this](const auto& e) { return e->resource.expired() || e->resource == resource; }); });
+ listeners.destroy = res->m_events.destroy.listen(
+ [this] { std::erase_if(g_pSeatManager->m_seatResources, [this](const auto& e) { return e->resource.expired() || e->resource == resource; }); });
}
void CSeatManager::onNewSeatResource(SP<CWLSeatResource> resource) {
@@ -151,7 +151,7 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
}
}
- m_listeners.keyboardSurfaceDestroy = surf->m_events.destroy.registerListener([this](std::any d) { setKeyboardFocus(nullptr); });
+ m_listeners.keyboardSurfaceDestroy = surf->m_events.destroy.listen([this] { setKeyboardFocus(nullptr); });
m_events.keyboardFocusChange.emit();
}
@@ -258,7 +258,7 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D&
sendPointerFrame();
- m_listeners.pointerSurfaceDestroy = surf->m_events.destroy.registerListener([this](std::any d) { setPointerFocus(nullptr, {}); });
+ m_listeners.pointerSurfaceDestroy = surf->m_events.destroy.listen([this] { setPointerFocus(nullptr, {}); });
m_events.pointerFocusChange.emit();
m_events.dndPointerFocusChange.emit();
@@ -372,7 +372,7 @@ void CSeatManager::sendTouchDown(SP<CWLSurfaceResource> surf, uint32_t timeMs, i
}
}
- m_listeners.touchSurfaceDestroy = surf->m_events.destroy.registerListener([this, timeMs, id](std::any d) { sendTouchUp(timeMs + 10, id); });
+ m_listeners.touchSurfaceDestroy = surf->m_events.destroy.listen([this, timeMs, id] { sendTouchUp(timeMs + 10, id); });
m_touchLocks++;
@@ -559,7 +559,7 @@ void CSeatManager::setCurrentSelection(SP<IDataSource> source) {
m_selection.currentSelection = source;
if (source) {
- m_selection.destroySelection = source->m_events.destroy.registerListener([this](std::any d) { setCurrentSelection(nullptr); });
+ m_selection.destroySelection = source->m_events.destroy.listen([this] { setCurrentSelection(nullptr); });
PROTO::data->setSelection(source);
PROTO::dataWlr->setSelection(source, false);
}
@@ -584,7 +584,7 @@ void CSeatManager::setCurrentPrimarySelection(SP<IDataSource> source) {
m_selection.currentPrimarySelection = source;
if (source) {
- m_selection.destroyPrimarySelection = source->m_events.destroy.registerListener([this](std::any d) { setCurrentPrimarySelection(nullptr); });
+ m_selection.destroyPrimarySelection = source->m_events.destroy.listen([this] { setCurrentPrimarySelection(nullptr); });
PROTO::primarySelection->setSelection(source);
PROTO::dataWlr->setSelection(source, true);
}
diff --git a/src/managers/SeatManager.hpp b/src/managers/SeatManager.hpp
index 6310f0d2..2d73e087 100644
--- a/src/managers/SeatManager.hpp
+++ b/src/managers/SeatManager.hpp
@@ -101,13 +101,13 @@ class CSeatManager {
};
struct {
- CSignal keyboardFocusChange;
- CSignal pointerFocusChange;
- CSignal dndPointerFocusChange;
- CSignal touchFocusChange;
- CSignal setCursor; // SSetCursorEvent
- CSignal setSelection;
- CSignal setPrimarySelection;
+ CSignalT<> keyboardFocusChange;
+ CSignalT<> pointerFocusChange;
+ CSignalT<> dndPointerFocusChange;
+ CSignalT<> touchFocusChange;
+ CSignalT<SSetCursorEvent> setCursor;
+ CSignalT<> setSelection;
+ CSignalT<> setPrimarySelection;
} m_events;
struct {
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp
index f39acf23..bfd819cf 100644
--- a/src/managers/SessionLockManager.cpp
+++ b/src/managers/SessionLockManager.cpp
@@ -12,7 +12,7 @@
SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : surface(surface_) {
pWlrSurface = surface->surface();
- listeners.map = surface_->m_events.map.registerListener([this](std::any data) {
+ listeners.map = surface_->m_events.map.listen([this] {
mapped = true;
g_pInputManager->simulateMouseMovement();
@@ -23,14 +23,14 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
g_pHyprRenderer->damageMonitor(PMONITOR);
});
- listeners.destroy = surface_->m_events.destroy.registerListener([this](std::any data) {
+ listeners.destroy = surface_->m_events.destroy.listen([this] {
if (pWlrSurface == g_pCompositor->m_lastFocus)
g_pCompositor->m_lastFocus.reset();
g_pSessionLockManager->removeSessionLockSurface(this);
});
- listeners.commit = surface_->m_events.commit.registerListener([this](std::any data) {
+ listeners.commit = surface_->m_events.commit.listen([this] {
const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID);
if (mapped && !g_pCompositor->m_lastFocus)
@@ -42,11 +42,10 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
}
CSessionLockManager::CSessionLockManager() {
- m_listeners.newLock = PROTO::sessionLock->m_events.newLock.registerListener([this](std::any data) { this->onNewSessionLock(std::any_cast<SP<CSessionLock>>(data)); });
+ m_listeners.newLock = PROTO::sessionLock->m_events.newLock.listen([this](const auto& lock) { this->onNewSessionLock(lock); });
}
void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
-
static auto PALLOWRELOCK = CConfigValue<Hyprlang::INT>("misc:allow_session_lock_restore");
if (PROTO::sessionLock->isLocked() && !*PALLOWRELOCK) {
@@ -61,17 +60,15 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_sessionLock->lock = pLock;
m_sessionLock->mLockTimer.reset();
- m_sessionLock->listeners.newSurface = pLock->m_events.newLockSurface.registerListener([this](std::any data) {
- auto SURFACE = std::any_cast<SP<CSessionLockSurface>>(data);
-
- const auto PMONITOR = SURFACE->monitor();
+ m_sessionLock->listeners.newSurface = pLock->m_events.newLockSurface.listen([this](const SP<CSessionLockSurface>& surface) {
+ const auto PMONITOR = surface->monitor();
- const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(SURFACE)).get();
+ const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(surface)).get();
NEWSURFACE->iMonitorID = PMONITOR->m_id;
- PROTO::fractional->sendScale(SURFACE->surface(), PMONITOR->m_scale);
+ PROTO::fractional->sendScale(surface->surface(), PMONITOR->m_scale);
});
- m_sessionLock->listeners.unlock = pLock->m_events.unlockAndDestroy.registerListener([this](std::any data) {
+ m_sessionLock->listeners.unlock = pLock->m_events.unlockAndDestroy.listen([this] {
m_sessionLock.reset();
g_pInputManager->refocus();
@@ -79,7 +76,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
g_pHyprRenderer->damageMonitor(m);
});
- m_sessionLock->listeners.destroy = pLock->m_events.destroyed.registerListener([this](std::any data) {
+ m_sessionLock->listeners.destroy = pLock->m_events.destroyed.listen([this] {
m_sessionLock.reset();
g_pCompositor->focusSurface(nullptr);
diff --git a/src/managers/eventLoop/EventLoopManager.cpp b/src/managers/eventLoop/EventLoopManager.cpp
index 5b2e09d1..357c2fff 100644
--- a/src/managers/eventLoop/EventLoopManager.cpp
+++ b/src/managers/eventLoop/EventLoopManager.cpp
@@ -88,7 +88,7 @@ void CEventLoopManager::enterLoop() {
m_configWatcherInotifySource = wl_event_loop_add_fd(m_wayland.loop, FD.get(), WL_EVENT_READABLE, configWatcherWrite, nullptr);
syncPollFDs();
- m_listeners.pollFDsChanged = g_pCompositor->m_aqBackend->events.pollFDsChanged.registerListener([this](std::any d) { syncPollFDs(); });
+ m_listeners.pollFDsChanged = g_pCompositor->m_aqBackend->events.pollFDsChanged.listen([this] { syncPollFDs(); });
// if we have a session, dispatch it to get the pending input devices
if (g_pCompositor->m_aqBackend->hasSession())
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)
diff --git a/src/protocols/AlphaModifier.cpp b/src/protocols/AlphaModifier.cpp
index ad4bc107..31e5e996 100644
--- a/src/protocols/AlphaModifier.cpp
+++ b/src/protocols/AlphaModifier.cpp
@@ -30,7 +30,7 @@ void CAlphaModifier::setResource(SP<CWpAlphaModifierSurfaceV1> resource) {
m_alpha = alpha / (float)UINT32_MAX;
});
- m_listeners.surfaceCommitted = m_surface->m_events.commit.registerListener([this](std::any data) {
+ m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
auto surface = CWLSurface::fromResource(m_surface.lock());
if (surface && surface->m_alphaModifier != m_alpha) {
@@ -45,7 +45,7 @@ void CAlphaModifier::setResource(SP<CWpAlphaModifierSurfaceV1> resource) {
}
});
- m_listeners.surfaceDestroyed = m_surface->m_events.destroy.registerListener([this](std::any data) {
+ m_listeners.surfaceDestroyed = m_surface->m_events.destroy.listen([this] {
if (!m_resource)
PROTO::alphaModifier->destroyAlphaModifier(this);
});
diff --git a/src/protocols/ContentType.cpp b/src/protocols/ContentType.cpp
index 218c7aeb..ba2c1533 100644
--- a/src/protocols/ContentType.cpp
+++ b/src/protocols/ContentType.cpp
@@ -42,7 +42,7 @@ bool CContentTypeManager::good() {
}
CContentType::CContentType(WP<CWLSurfaceResource> surface) {
- m_destroy = surface->m_events.destroy.registerListener([this](std::any d) { PROTO::contentType->destroyResource(this); });
+ m_destroy = surface->m_events.destroy.listen([this] { PROTO::contentType->destroyResource(this); });
}
CContentType::CContentType(SP<CWpContentTypeV1> resource) : m_resource(resource) {
diff --git a/src/protocols/CursorShape.hpp b/src/protocols/CursorShape.hpp
index d7ae75c1..918032ab 100644
--- a/src/protocols/CursorShape.hpp
+++ b/src/protocols/CursorShape.hpp
@@ -18,7 +18,7 @@ class CCursorShapeProtocol : public IWaylandProtocol {
};
struct {
- CSignal setShape;
+ CSignalT<SSetShapeEvent> setShape;
} m_events;
private:
@@ -38,4 +38,4 @@ class CCursorShapeProtocol : public IWaylandProtocol {
namespace PROTO {
inline UP<CCursorShapeProtocol> cursorShape;
-}; \ No newline at end of file
+};
diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp
index 891b503c..d64555f2 100644
--- a/src/protocols/DRMLease.cpp
+++ b/src/protocols/DRMLease.cpp
@@ -64,7 +64,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
m->m_monitor->m_isBeingLeased = true;
}
- m_listeners.destroyLease = m_lease->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroyLease = m_lease->events.destroy.listen([this] {
for (auto const& m : m_requested) {
if (m && m->m_monitor)
m->m_monitor->m_isBeingLeased = false;
@@ -167,7 +167,7 @@ CDRMLeaseConnectorResource::CDRMLeaseConnectorResource(WP<CDRMLeaseDeviceResourc
m_resource->setData(this);
- m_listeners.destroyMonitor = m_monitor->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroyMonitor = m_monitor->m_events.destroy.listen([this] {
m_resource->sendWithdrawn();
m_dead = true;
});
diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp
index 12adc387..2f5c3e14 100644
--- a/src/protocols/DRMSyncobj.cpp
+++ b/src/protocols/DRMSyncobj.cpp
@@ -74,7 +74,7 @@ CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(UP<CWpLinuxDrmSyncobjSurf
m_pendingRelease = {timeline->m_timeline, ((uint64_t)hi << 32) | (uint64_t)lo};
});
- m_listeners.surfacePrecommit = m_surface->m_events.precommit.registerListener([this](std::any d) {
+ m_listeners.surfacePrecommit = m_surface->m_events.precommit.listen([this] {
if (!m_surface->m_pending.updated.bits.buffer || !m_surface->m_pending.buffer) {
if (m_pendingAcquire.timeline() || m_pendingRelease.timeline()) {
m_resource->error(WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_BUFFER, "Missing buffer");
diff --git a/src/protocols/ExtWorkspace.cpp b/src/protocols/ExtWorkspace.cpp
index 6c55e76e..ecba454e 100644
--- a/src/protocols/ExtWorkspace.cpp
+++ b/src/protocols/ExtWorkspace.cpp
@@ -15,7 +15,7 @@ CExtWorkspaceGroupResource::CExtWorkspaceGroupResource(WP<CExtWorkspaceManagerRe
m_resource->setData(this);
m_manager->m_resource->sendWorkspaceGroup(m_resource.get());
- m_listeners.destroyed = m_monitor->m_events.destroy.registerListener([this](auto) { m_resource->sendRemoved(); });
+ m_listeners.destroyed = m_monitor->m_events.destroy.listen([this] { m_resource->sendRemoved(); });
m_resource->setOnDestroy([this](auto) { PROTO::extWorkspace->destroyGroup(m_self); });
m_resource->setDestroy([this](auto) { PROTO::extWorkspace->destroyGroup(m_self); });
@@ -27,11 +27,9 @@ CExtWorkspaceGroupResource::CExtWorkspaceGroupResource(WP<CExtWorkspaceManagerRe
if (auto resource = output->outputResourceFrom(m_resource->client()))
m_resource->sendOutputEnter(resource->getResource()->resource());
- m_listeners.outputBound = output->m_events.outputBound.registerListener([this](std::any data) {
- auto resource = std::any_cast<SP<CWLOutputResource>>(data);
-
- if (resource->client() == m_resource->client())
- m_resource->sendOutputEnter(resource->getResource()->resource());
+ m_listeners.outputBound = output->m_events.outputBound.listen([this](const SP<CWLOutputResource>& output) {
+ if (output->client() == m_resource->client())
+ m_resource->sendOutputEnter(output->getResource()->resource());
});
m_manager->sendGroupToWorkspaces(m_self);
@@ -63,21 +61,21 @@ CExtWorkspaceResource::CExtWorkspaceResource(WP<CExtWorkspaceManagerResource> ma
m_resource->setData(this);
m_manager->m_resource->sendWorkspace(m_resource.get());
- m_listeners.destroyed = m_workspace->m_events.destroy.registerListener([this](auto) {
+ m_listeners.destroyed = m_workspace->m_events.destroy.listen([this] {
m_resource->sendRemoved();
if (m_manager)
m_manager->scheduleDone();
});
- m_listeners.activeChanged = m_workspace->m_events.activeChange.registerListener([this](auto) {
+ m_listeners.activeChanged = m_workspace->m_events.activeChanged.listen([this] {
sendState();
sendCapabilities();
});
- m_listeners.monitorChanged = m_workspace->m_events.monitorChange.registerListener([this](auto) { this->sendGroup(); });
+ m_listeners.monitorChanged = m_workspace->m_events.monitorChanged.listen([this] { this->sendGroup(); });
- m_listeners.renamed = m_workspace->m_events.rename.registerListener([this](auto) {
+ m_listeners.renamed = m_workspace->m_events.renamed.listen([this] {
m_resource->sendName(m_workspace->m_name.c_str());
if (m_manager)
diff --git a/src/protocols/FocusGrab.cpp b/src/protocols/FocusGrab.cpp
index 41396459..3ab8d1e2 100644
--- a/src/protocols/FocusGrab.cpp
+++ b/src/protocols/FocusGrab.cpp
@@ -8,7 +8,7 @@
#include <wayland-server.h>
CFocusGrabSurfaceState::CFocusGrabSurfaceState(CFocusGrab* grab, SP<CWLSurfaceResource> surface) {
- m_listeners.destroy = surface->m_events.destroy.registerListener([=](std::any d) { grab->eraseSurface(surface); });
+ m_listeners.destroy = surface->m_events.destroy.listen([grab, surface] { grab->eraseSurface(surface); });
}
CFocusGrab::CFocusGrab(SP<CHyprlandFocusGrabV1> resource_) : m_resource(resource_) {
diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp
index 1d5b4fd5..29a9cae4 100644
--- a/src/protocols/GammaControl.cpp
+++ b/src/protocols/GammaControl.cpp
@@ -108,8 +108,8 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
m_resource->sendGammaSize(m_gammaSize);
- m_listeners.monitorDestroy = m_monitor->m_events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
- m_listeners.monitorDisconnect = m_monitor->m_events.disconnect.registerListener([this](std::any) { this->onMonitorDestroy(); });
+ m_listeners.monitorDestroy = m_monitor->m_events.destroy.listen([this] { this->onMonitorDestroy(); });
+ m_listeners.monitorDisconnect = m_monitor->m_events.disconnect.listen([this] { this->onMonitorDestroy(); });
}
CGammaControl::~CGammaControl() {
diff --git a/src/protocols/HyprlandSurface.cpp b/src/protocols/HyprlandSurface.cpp
index 2e386027..b2692d1f 100644
--- a/src/protocols/HyprlandSurface.cpp
+++ b/src/protocols/HyprlandSurface.cpp
@@ -51,7 +51,7 @@ void CHyprlandSurface::setResource(SP<CHyprlandSurfaceV1> resource) {
m_visibleRegion = CWLRegionResource::fromResource(region)->m_region;
});
- m_listeners.surfaceCommitted = m_surface->m_events.commit.registerListener([this](std::any data) {
+ m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
auto surface = CWLSurface::fromResource(m_surface.lock());
if (surface && (surface->m_overallOpacity != m_opacity || m_visibleRegionChanged)) {
@@ -67,7 +67,7 @@ void CHyprlandSurface::setResource(SP<CHyprlandSurfaceV1> resource) {
}
});
- m_listeners.surfaceDestroyed = m_surface->m_events.destroy.registerListener([this](std::any data) {
+ m_listeners.surfaceDestroyed = m_surface->m_events.destroy.listen([this] {
if (!m_resource)
PROTO::hyprlandSurface->destroySurface(this);
});
diff --git a/src/protocols/IdleInhibit.cpp b/src/protocols/IdleInhibit.cpp
index f8031d22..e7e0e676 100644
--- a/src/protocols/IdleInhibit.cpp
+++ b/src/protocols/IdleInhibit.cpp
@@ -6,7 +6,7 @@ CIdleInhibitor::CIdleInhibitor(SP<CIdleInhibitorResource> resource_, SP<CWLSurfa
}
CIdleInhibitorResource::CIdleInhibitorResource(SP<CZwpIdleInhibitorV1> resource_, SP<CWLSurfaceResource> surface_) : m_resource(resource_), m_surface(surface_) {
- m_listeners.destroySurface = m_surface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = m_surface->m_events.destroy.listen([this] {
m_surface.reset();
m_listeners.destroySurface.reset();
m_destroySent = true;
@@ -49,4 +49,4 @@ void CIdleInhibitProtocol::onCreateInhibitor(CZwpIdleInhibitManagerV1* pMgr, uin
RESOURCE->m_inhibitor = makeShared<CIdleInhibitor>(RESOURCE, surface);
m_events.newIdleInhibitor.emit(RESOURCE->m_inhibitor);
-} \ No newline at end of file
+}
diff --git a/src/protocols/IdleInhibit.hpp b/src/protocols/IdleInhibit.hpp
index 791d83f9..e04b6725 100644
--- a/src/protocols/IdleInhibit.hpp
+++ b/src/protocols/IdleInhibit.hpp
@@ -28,7 +28,7 @@ class CIdleInhibitorResource {
SP<CIdleInhibitor> m_inhibitor;
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
private:
@@ -48,7 +48,7 @@ class CIdleInhibitProtocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newIdleInhibitor; // data: SP<CIdleInhibitor>
+ CSignalT<SP<CIdleInhibitor>> newIdleInhibitor;
} m_events;
private:
diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp
index 63f9f33f..7826a962 100644
--- a/src/protocols/InputMethodV2.cpp
+++ b/src/protocols/InputMethodV2.cpp
@@ -89,7 +89,7 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
m_surface = surface;
- m_listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = surface->m_events.destroy.listen([this] {
if (m_mapped)
m_events.unmap.emit();
@@ -102,7 +102,7 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
m_surface.reset();
});
- m_listeners.commitSurface = surface->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.commitSurface = surface->m_events.commit.listen([this] {
if (m_surface->m_current.texture && !m_mapped) {
m_mapped = true;
m_surface->map();
diff --git a/src/protocols/InputMethodV2.hpp b/src/protocols/InputMethodV2.hpp
index 74efcbb3..4ee579ec 100644
--- a/src/protocols/InputMethodV2.hpp
+++ b/src/protocols/InputMethodV2.hpp
@@ -18,9 +18,9 @@ class CInputMethodV2 {
~CInputMethodV2();
struct {
- CSignal onCommit;
- CSignal destroy;
- CSignal newPopup;
+ CSignalT<> onCommit;
+ CSignalT<> destroy;
+ CSignalT<SP<CInputMethodPopupV2>> newPopup;
} m_events;
struct SState {
@@ -110,10 +110,10 @@ class CInputMethodPopupV2 {
SP<CWLSurfaceResource> surface();
struct {
- CSignal map;
- CSignal unmap;
- CSignal commit;
- CSignal destroy;
+ CSignalT<> map;
+ CSignalT<> unmap;
+ CSignalT<> commit;
+ CSignalT<> destroy;
} m_events;
bool m_mapped = false;
@@ -136,7 +136,7 @@ class CInputMethodV2Protocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newIME; // SP<CInputMethodV2>
+ CSignalT<SP<CInputMethodV2>> newIME;
} m_events;
private:
@@ -160,4 +160,4 @@ class CInputMethodV2Protocol : public IWaylandProtocol {
namespace PROTO {
inline UP<CInputMethodV2Protocol> ime;
-}; \ No newline at end of file
+};
diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp
index bb5480b6..be9e3370 100644
--- a/src/protocols/LayerShell.cpp
+++ b/src/protocols/LayerShell.cpp
@@ -33,14 +33,14 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
PROTO::layerShell->destroyResource(this);
});
- m_listeners.destroySurface = surf_->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = surf_->m_events.destroy.listen([this] {
m_events.destroy.emit();
PROTO::layerShell->destroyResource(this);
});
- m_listeners.unmapSurface = surf_->m_events.unmap.registerListener([this](std::any d) { m_events.unmap.emit(); });
+ m_listeners.unmapSurface = surf_->m_events.unmap.listen([this] { m_events.unmap.emit(); });
- m_listeners.commitSurface = surf_->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.commitSurface = surf_->m_events.commit.listen([this] {
m_current = m_pending;
m_pending.committed = 0;
diff --git a/src/protocols/LayerShell.hpp b/src/protocols/LayerShell.hpp
index c6c162a3..ce8de05a 100644
--- a/src/protocols/LayerShell.hpp
+++ b/src/protocols/LayerShell.hpp
@@ -10,6 +10,7 @@
#include "types/SurfaceRole.hpp"
class CMonitor;
+class CXDGPopupResource;
class CWLSurfaceResource;
class CLayerShellResource;
@@ -44,11 +45,11 @@ class CLayerShellResource {
};
struct {
- CSignal destroy;
- CSignal commit;
- CSignal map;
- CSignal unmap;
- CSignal newPopup; // wlr_xdg_popup*
+ CSignalT<> destroy;
+ CSignalT<> commit;
+ CSignalT<> map;
+ CSignalT<> unmap;
+ CSignalT<SP<CXDGPopupResource>> newPopup;
} m_events;
struct SState {
diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp
index a0fe571a..8bf95c13 100644
--- a/src/protocols/LinuxDMABUF.cpp
+++ b/src/protocols/LinuxDMABUF.cpp
@@ -99,7 +99,7 @@ CLinuxDMABuffer::CLinuxDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDM
m_buffer->m_resource->m_buffer = m_buffer;
- m_listeners.bufferResourceDestroy = m_buffer->events.destroy.registerListener([this](std::any d) {
+ m_listeners.bufferResourceDestroy = m_buffer->events.destroy.listen([this] {
m_listeners.bufferResourceDestroy.reset();
PROTO::linuxDma->destroyResource(this);
});
diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp
index c8532265..45ee24c5 100644
--- a/src/protocols/MesaDRM.cpp
+++ b/src/protocols/MesaDRM.cpp
@@ -14,7 +14,7 @@ CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, A
m_buffer = makeShared<CDMABuffer>(id, client, attrs_);
m_buffer->m_resource->m_buffer = m_buffer;
- m_listeners.bufferResourceDestroy = m_buffer->events.destroy.registerListener([this](std::any d) {
+ m_listeners.bufferResourceDestroy = m_buffer->events.destroy.listen([this] {
m_listeners.bufferResourceDestroy.reset();
PROTO::mesaDRM->destroyResource(this);
});
diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp
index b5c0de74..ab2ec88a 100644
--- a/src/protocols/OutputManagement.cpp
+++ b/src/protocols/OutputManagement.cpp
@@ -96,7 +96,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_)
m_resource->setRelease([this](CZwlrOutputHeadV1* r) { PROTO::outputManagement->destroyResource(this); });
m_resource->setOnDestroy([this](CZwlrOutputHeadV1* r) { PROTO::outputManagement->destroyResource(this); });
- m_listeners.monitorDestroy = m_monitor->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.monitorDestroy = m_monitor->m_events.destroy.listen([this] {
m_resource->sendFinished();
for (auto const& mw : m_modes) {
@@ -114,7 +114,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_)
}
});
- m_listeners.monitorModeChange = m_monitor->m_events.modeChanged.registerListener([this](std::any d) { updateMode(); });
+ m_listeners.monitorModeChange = m_monitor->m_events.modeChanged.listen([this] { updateMode(); });
}
bool COutputHead::good() {
diff --git a/src/protocols/OutputPower.cpp b/src/protocols/OutputPower.cpp
index bae3078f..e3cc7336 100644
--- a/src/protocols/OutputPower.cpp
+++ b/src/protocols/OutputPower.cpp
@@ -23,15 +23,15 @@ COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, PHLMONITOR pMonitor
m_resource->sendMode(m_monitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF);
- m_listeners.monitorDestroy = m_monitor->m_events.destroy.registerListener([this](std::any v) {
+ m_listeners.monitorDestroy = m_monitor->m_events.destroy.listen([this] {
m_monitor.reset();
m_resource->sendFailed();
});
- m_listeners.monitorDpms = m_monitor->m_events.dpmsChanged.registerListener(
- [this](std::any v) { m_resource->sendMode(m_monitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
- m_listeners.monitorState = m_monitor->m_events.modeChanged.registerListener(
- [this](std::any v) { m_resource->sendMode(m_monitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
+ m_listeners.monitorDpms =
+ m_monitor->m_events.dpmsChanged.listen([this] { m_resource->sendMode(m_monitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
+ m_listeners.monitorState =
+ m_monitor->m_events.modeChanged.listen([this] { m_resource->sendMode(m_monitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
}
bool COutputPower::good() {
diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp
index ea917932..24ccc980 100644
--- a/src/protocols/PointerConstraints.cpp
+++ b/src/protocols/PointerConstraints.cpp
@@ -80,7 +80,7 @@ CPointerConstraint::~CPointerConstraint() {
void CPointerConstraint::sharedConstructions() {
if (m_hlSurface) {
- m_listeners.destroySurface = m_hlSurface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = m_hlSurface->m_events.destroy.listen([this] {
m_hlSurface.reset();
if (m_active)
deactivate();
diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp
index 2b01eddd..9a61f25a 100644
--- a/src/protocols/PrimarySelection.cpp
+++ b/src/protocols/PrimarySelection.cpp
@@ -228,7 +228,7 @@ void CPrimarySelectionProtocol::bindManager(wl_client* client, void* data, uint3
// we need to do it here because protocols come before seatMgr
if (!m_listeners.onPointerFocusChange)
- m_listeners.onPointerFocusChange = g_pSeatManager->m_events.pointerFocusChange.registerListener([this](std::any d) { this->onPointerFocus(); });
+ m_listeners.onPointerFocusChange = g_pSeatManager->m_events.pointerFocusChange.listen([this] { this->onPointerFocus(); });
}
void CPrimarySelectionProtocol::destroyResource(CPrimarySelectionManager* resource) {
diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp
index d3916fdc..64c0569b 100644
--- a/src/protocols/SessionLock.cpp
+++ b/src/protocols/SessionLock.cpp
@@ -24,7 +24,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
m_resource->setAckConfigure([this](CExtSessionLockSurfaceV1* r, uint32_t serial) { m_ackdConfigure = true; });
- m_listeners.surfaceCommit = m_surface->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.surfaceCommit = m_surface->m_events.commit.listen([this] {
if (!m_surface->m_current.texture) {
LOGM(ERR, "SessionLock attached a null buffer");
m_resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, "Null buffer attached");
@@ -46,7 +46,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
m_committed = true;
});
- m_listeners.surfaceDestroy = m_surface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] {
LOGM(WARN, "SessionLockSurface object remains but surface is being destroyed???");
m_surface->unmap();
m_listeners.surfaceCommit.reset();
@@ -61,7 +61,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
sendConfigure();
- m_listeners.monitorMode = m_monitor->m_events.modeChanged.registerListener([this](std::any data) { sendConfigure(); });
+ m_listeners.monitorMode = m_monitor->m_events.modeChanged.listen([this] { sendConfigure(); });
}
CSessionLockSurface::~CSessionLockSurface() {
diff --git a/src/protocols/SessionLock.hpp b/src/protocols/SessionLock.hpp
index 8f0e0af6..09b48b32 100644
--- a/src/protocols/SessionLock.hpp
+++ b/src/protocols/SessionLock.hpp
@@ -21,9 +21,9 @@ class CSessionLockSurface {
SP<CWLSurfaceResource> surface();
struct {
- CSignal map;
- CSignal destroy;
- CSignal commit;
+ CSignalT<> map;
+ CSignalT<> destroy;
+ CSignalT<> commit;
} m_events;
private:
@@ -54,9 +54,9 @@ class CSessionLock {
void sendDenied();
struct {
- CSignal newLockSurface; // SP<CSessionLockSurface>
- CSignal unlockAndDestroy;
- CSignal destroyed; // fires regardless of whether there was a unlockAndDestroy or not.
+ CSignalT<SP<CSessionLockSurface>> newLockSurface;
+ CSignalT<> unlockAndDestroy;
+ CSignalT<> destroyed; // fires regardless of whether there was a unlockAndDestroy or not.
} m_events;
private:
@@ -76,7 +76,7 @@ class CSessionLockProtocol : public IWaylandProtocol {
bool isLocked();
struct {
- CSignal newLock; // SP<CSessionLock>
+ CSignalT<SP<CSessionLock>> newLock;
} m_events;
private:
diff --git a/src/protocols/SinglePixel.cpp b/src/protocols/SinglePixel.cpp
index d069da0d..42c4f8ed 100644
--- a/src/protocols/SinglePixel.cpp
+++ b/src/protocols/SinglePixel.cpp
@@ -69,7 +69,7 @@ CSinglePixelBufferResource::CSinglePixelBufferResource(uint32_t id, wl_client* c
m_buffer->m_resource->m_buffer = m_buffer;
- m_listeners.bufferResourceDestroy = m_buffer->events.destroy.registerListener([this](std::any d) {
+ m_listeners.bufferResourceDestroy = m_buffer->events.destroy.listen([this] {
m_listeners.bufferResourceDestroy.reset();
PROTO::singlePixel->destroyResource(this);
});
diff --git a/src/protocols/TextInputV1.hpp b/src/protocols/TextInputV1.hpp
index 5f74bf72..f22dfdfe 100644
--- a/src/protocols/TextInputV1.hpp
+++ b/src/protocols/TextInputV1.hpp
@@ -33,11 +33,11 @@ class CTextInputV1 {
bool m_active = false;
struct {
- CSignal onCommit;
- CSignal enable;
- CSignal disable;
- CSignal reset;
- CSignal destroy;
+ CSignalT<> onCommit;
+ CSignalT<SP<CWLSurfaceResource>> enable;
+ CSignalT<> disable;
+ CSignalT<> reset;
+ CSignalT<> destroy;
} m_events;
struct SPendingSurr {
@@ -68,7 +68,7 @@ class CTextInputV1Protocol : public IWaylandProtocol {
void destroyResource(CZwpTextInputManagerV1* client);
struct {
- CSignal newTextInput; // WP<CTextInputV3>
+ CSignalT<WP<CTextInputV1>> newTextInput;
} m_events;
private:
diff --git a/src/protocols/TextInputV3.hpp b/src/protocols/TextInputV3.hpp
index 65d29b7f..420adf53 100644
--- a/src/protocols/TextInputV3.hpp
+++ b/src/protocols/TextInputV3.hpp
@@ -27,11 +27,11 @@ class CTextInputV3 {
wl_client* client();
struct {
- CSignal onCommit;
- CSignal enable;
- CSignal disable;
- CSignal reset;
- CSignal destroy;
+ CSignalT<> onCommit;
+ CSignalT<> enable;
+ CSignalT<> disable;
+ CSignalT<> reset;
+ CSignalT<> destroy;
} m_events;
struct SState {
@@ -80,7 +80,7 @@ class CTextInputV3Protocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newTextInput; // WP<CTextInputV3>
+ CSignalT<WP<CTextInputV3>> newTextInput;
} m_events;
private:
@@ -97,4 +97,4 @@ class CTextInputV3Protocol : public IWaylandProtocol {
namespace PROTO {
inline UP<CTextInputV3Protocol> textInputV3;
-}; \ No newline at end of file
+};
diff --git a/src/protocols/Viewporter.cpp b/src/protocols/Viewporter.cpp
index f13d7540..06a47382 100644
--- a/src/protocols/Viewporter.cpp
+++ b/src/protocols/Viewporter.cpp
@@ -55,7 +55,7 @@ CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceRes
m_surface->m_pending.viewport.source = {x, y, w, h};
});
- m_listeners.surfacePrecommit = m_surface->m_events.precommit.registerListener([this](std::any d) {
+ m_listeners.surfacePrecommit = m_surface->m_events.precommit.listen([this] {
if (!m_surface || !m_surface->m_pending.buffer)
return;
diff --git a/src/protocols/VirtualKeyboard.hpp b/src/protocols/VirtualKeyboard.hpp
index ad2eccfa..c601c0fb 100644
--- a/src/protocols/VirtualKeyboard.hpp
+++ b/src/protocols/VirtualKeyboard.hpp
@@ -3,6 +3,8 @@
#include <vector>
#include <cstdint>
#include "WaylandProtocol.hpp"
+#include "../devices/IKeyboard.hpp"
+#include "../devices/VirtualKeyboard.hpp"
#include "virtual-keyboard-unstable-v1.hpp"
#include "../helpers/signal/Signal.hpp"
#include <hyprutils/os/FileDescriptor.hpp>
@@ -13,10 +15,10 @@ class CVirtualKeyboardV1Resource {
~CVirtualKeyboardV1Resource();
struct {
- CSignal destroy;
- CSignal key;
- CSignal modifiers;
- CSignal keymap;
+ CSignalT<> destroy;
+ CSignalT<IKeyboard::SKeyEvent> key;
+ CSignalT<IKeyboard::SModifiersEvent> modifiers;
+ CSignalT<IKeyboard::SKeymapEvent> keymap;
} m_events;
bool good();
@@ -41,7 +43,7 @@ class CVirtualKeyboardProtocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newKeyboard; // SP<CVirtualKeyboard>
+ CSignalT<SP<CVirtualKeyboardV1Resource>> newKeyboard;
} m_events;
private:
diff --git a/src/protocols/VirtualPointer.cpp b/src/protocols/VirtualPointer.cpp
index e40d35f2..c083fc3f 100644
--- a/src/protocols/VirtualPointer.cpp
+++ b/src/protocols/VirtualPointer.cpp
@@ -148,4 +148,4 @@ void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr
LOGM(LOG, "New VPointer at id {}", id);
m_events.newPointer.emit(RESOURCE);
-} \ No newline at end of file
+}
diff --git a/src/protocols/VirtualPointer.hpp b/src/protocols/VirtualPointer.hpp
index a608086a..96f31d81 100644
--- a/src/protocols/VirtualPointer.hpp
+++ b/src/protocols/VirtualPointer.hpp
@@ -15,23 +15,23 @@ class CVirtualPointerV1Resource {
~CVirtualPointerV1Resource();
struct {
- CSignal destroy;
- CSignal move;
- CSignal warp;
- CSignal button;
- CSignal axis;
- CSignal frame;
-
- CSignal swipeBegin;
- CSignal swipeUpdate;
- CSignal swipeEnd;
-
- CSignal pinchBegin;
- CSignal pinchUpdate;
- CSignal pinchEnd;
-
- CSignal holdBegin;
- CSignal holdEnd;
+ CSignalT<> destroy;
+ CSignalT<IPointer::SMotionEvent> move;
+ CSignalT<IPointer::SMotionAbsoluteEvent> warp;
+ CSignalT<IPointer::SButtonEvent> button;
+ CSignalT<IPointer::SAxisEvent> axis;
+ CSignalT<> frame;
+
+ CSignalT<IPointer::SSwipeBeginEvent> swipeBegin;
+ CSignalT<IPointer::SSwipeUpdateEvent> swipeUpdate;
+ CSignalT<IPointer::SSwipeEndEvent> swipeEnd;
+
+ CSignalT<IPointer::SPinchBeginEvent> pinchBegin;
+ CSignalT<IPointer::SPinchUpdateEvent> pinchUpdate;
+ CSignalT<IPointer::SPinchEndEvent> pinchEnd;
+
+ CSignalT<IPointer::SHoldBeginEvent> holdBegin;
+ CSignalT<IPointer::SHoldEndEvent> holdEnd;
} m_events;
bool good();
@@ -56,7 +56,7 @@ class CVirtualPointerProtocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newPointer; // SP<CVirtualPointerV1Resource>
+ CSignalT<SP<CVirtualPointerV1Resource>> newPointer;
} m_events;
private:
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
index 5351e267..488ff6f1 100644
--- a/src/protocols/XDGShell.cpp
+++ b/src/protocols/XDGShell.cpp
@@ -372,7 +372,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
PROTO::xdgShell->destroyResource(this);
});
- m_listeners.surfaceDestroy = m_surface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] {
LOGM(WARN, "wl_surface destroyed before its xdg_surface role object");
m_listeners.surfaceDestroy.reset();
m_listeners.surfaceCommit.reset();
@@ -385,7 +385,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
m_events.destroy.emit();
});
- m_listeners.surfaceCommit = m_surface->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.surfaceCommit = m_surface->m_events.commit.listen([this] {
m_current = m_pending;
if (m_toplevel)
m_toplevel->m_current = m_toplevel->m_pending;
@@ -436,7 +436,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
for (auto const& p : m_popups) {
if (!p)
continue;
- m_events.newPopup.emit(p);
+ m_events.newPopup.emit(p.lock());
}
});
diff --git a/src/protocols/XDGShell.hpp b/src/protocols/XDGShell.hpp
index 632467ec..fbb6ba94 100644
--- a/src/protocols/XDGShell.hpp
+++ b/src/protocols/XDGShell.hpp
@@ -63,9 +63,9 @@ class CXDGPopupResource {
CBox m_geometry;
struct {
- CSignal reposition;
- CSignal dismissed;
- CSignal destroy; // only the role
+ CSignalT<> reposition;
+ CSignalT<> dismissed;
+ CSignalT<> destroy; // only the role
} m_events;
// schedules a configure event
@@ -111,10 +111,10 @@ class CXDGToplevelResource {
void close();
struct {
- CSignal sizeLimitsChanged;
- CSignal stateChanged; // maximized, fs, minimized, etc.
- CSignal metadataChanged; // title, appid
- CSignal destroy; // only the role
+ CSignalT<> sizeLimitsChanged;
+ CSignalT<> stateChanged; // maximized, fs, minimized, etc.
+ CSignalT<> metadataChanged; // title, appid
+ CSignalT<> destroy; // only the role
} m_events;
struct {
@@ -186,12 +186,12 @@ class CXDGSurfaceResource {
} m_pending, m_current;
struct {
- CSignal ack;
- CSignal commit;
- CSignal map;
- CSignal unmap;
- CSignal destroy;
- CSignal newPopup; // SP<CXDGPopupResource>
+ CSignalT<uint32_t> ack;
+ CSignalT<> commit;
+ CSignalT<> map;
+ CSignalT<> unmap;
+ CSignalT<> destroy;
+ CSignalT<SP<CXDGPopupResource>> newPopup;
} m_events;
bool m_initialCommit = true;
@@ -252,7 +252,7 @@ class CXDGWMBase {
WP<CXDGWMBase> m_self;
struct {
- CSignal pong;
+ CSignalT<> pong;
} m_events;
private:
diff --git a/src/protocols/XWaylandShell.hpp b/src/protocols/XWaylandShell.hpp
index a83f258e..346bfe88 100644
--- a/src/protocols/XWaylandShell.hpp
+++ b/src/protocols/XWaylandShell.hpp
@@ -17,7 +17,7 @@ class CXWaylandSurfaceResource {
wl_client* client();
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} events;
uint64_t m_serial = 0;
@@ -47,7 +47,7 @@ class CXWaylandShellProtocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newSurface; // SP<CXWaylandSurfaceResource>. Fired when it sets a serial, otherwise it's useless
+ CSignalT<SP<CXWaylandSurfaceResource>> newSurface; // Fired when it sets a serial, otherwise it's useless
} m_events;
private:
diff --git a/src/protocols/core/Compositor.hpp b/src/protocols/core/Compositor.hpp
index 90fac35d..26b5a27b 100644
--- a/src/protocols/core/Compositor.hpp
+++ b/src/protocols/core/Compositor.hpp
@@ -80,12 +80,12 @@ class CWLSurfaceResource {
void resetRole();
struct {
- CSignal precommit; // before commit
- CSignal commit; // after commit
- CSignal map;
- CSignal unmap;
- CSignal newSubsurface;
- CSignal destroy;
+ CSignalT<> precommit; // before commit
+ CSignalT<> commit; // after commit
+ CSignalT<> map;
+ CSignalT<> unmap;
+ CSignalT<SP<CWLSubsurfaceResource>> newSubsurface;
+ CSignalT<> destroy;
} m_events;
SSurfaceState m_current;
@@ -146,7 +146,7 @@ class CWLCompositorProtocol : public IWaylandProtocol {
void forEachSurface(std::function<void(SP<CWLSurfaceResource>)> fn);
struct {
- CSignal newSurface; // SP<CWLSurfaceResource>
+ CSignalT<SP<CWLSurfaceResource>> newSurface;
} m_events;
private:
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index 730113f1..4435e4c7 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -385,8 +385,8 @@ bool CWLDataDeviceManagerResource::good() {
CWLDataDeviceProtocol::CWLDataDeviceProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
g_pEventLoopManager->doLater([this]() {
- m_listeners.onKeyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.registerListener([this](std::any d) { onKeyboardFocus(); });
- m_listeners.onDndPointerFocusChange = g_pSeatManager->m_events.dndPointerFocusChange.registerListener([this](std::any d) { onDndPointerFocus(); });
+ m_listeners.onKeyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.listen([this] { onKeyboardFocus(); });
+ m_listeners.onDndPointerFocusChange = g_pSeatManager->m_events.dndPointerFocusChange.listen([this] { onDndPointerFocus(); });
});
}
@@ -564,8 +564,8 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
m_dnd.originSurface = origin;
m_dnd.dndSurface = dragSurface;
if (dragSurface) {
- m_dnd.dndSurfaceDestroy = dragSurface->m_events.destroy.registerListener([this](std::any d) { abortDrag(); });
- m_dnd.dndSurfaceCommit = dragSurface->m_events.commit.registerListener([this](std::any d) {
+ m_dnd.dndSurfaceDestroy = dragSurface->m_events.destroy.listen([this] { abortDrag(); });
+ m_dnd.dndSurfaceCommit = dragSurface->m_events.commit.listen([this] {
if (m_dnd.dndSurface->m_current.texture && !m_dnd.dndSurface->m_mapped) {
m_dnd.dndSurface->map();
return;
diff --git a/src/protocols/core/Output.cpp b/src/protocols/core/Output.cpp
index a9d75972..8ebf87eb 100644
--- a/src/protocols/core/Output.cpp
+++ b/src/protocols/core/Output.cpp
@@ -86,7 +86,7 @@ void CWLOutputResource::updateState() {
CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, PHLMONITOR pMonitor) :
IWaylandProtocol(iface, ver, name), m_monitor(pMonitor), m_name(pMonitor->m_name) {
- m_listeners.modeChanged = m_monitor->m_events.modeChanged.registerListener([this](std::any d) {
+ m_listeners.modeChanged = m_monitor->m_events.modeChanged.listen([this] {
for (auto const& o : m_outputs) {
o->updateState();
}
diff --git a/src/protocols/core/Output.hpp b/src/protocols/core/Output.hpp
index 50deccd3..d0c6fb13 100644
--- a/src/protocols/core/Output.hpp
+++ b/src/protocols/core/Output.hpp
@@ -47,7 +47,7 @@ class CWLOutputProtocol : public IWaylandProtocol {
bool isDefunct(); // true if above was called
struct {
- CSignal outputBound;
+ CSignalT<SP<CWLOutputResource>> outputBound;
} m_events;
private:
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp
index c341f95a..53123abe 100644
--- a/src/protocols/core/Seat.cpp
+++ b/src/protocols/core/Seat.cpp
@@ -32,7 +32,7 @@ void CWLTouchResource::sendDown(SP<CWLSurfaceResource> surface, uint32_t timeMs,
ASSERT(surface->client() == m_owner->client());
m_currentSurface = surface;
- m_listeners.destroySurface = surface->m_events.destroy.registerListener([this, timeMs, id](std::any d) { sendUp(timeMs + 10 /* hack */, id); });
+ m_listeners.destroySurface = surface->m_events.destroy.listen([this, timeMs, id] { sendUp(timeMs + 10 /* hack */, id); });
m_resource->sendDown(g_pSeatManager->nextSerial(m_owner.lock()), timeMs, surface->getResource().get(), id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
@@ -160,7 +160,7 @@ void CWLPointerResource::sendEnter(SP<CWLSurfaceResource> surface, const Vector2
ASSERT(surface->client() == m_owner->client());
m_currentSurface = surface;
- m_listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) { sendLeave(); });
+ m_listeners.destroySurface = surface->m_events.destroy.listen([this] { sendLeave(); });
m_resource->sendEnter(g_pSeatManager->nextSerial(m_owner.lock()), surface->getResource().get(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
}
@@ -349,7 +349,7 @@ void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface) {
ASSERT(surface->client() == m_owner->client());
m_currentSurface = surface;
- m_listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) { sendLeave(); });
+ m_listeners.destroySurface = surface->m_events.destroy.listen([this] { sendLeave(); });
wl_array arr;
wl_array_init(&arr);
diff --git a/src/protocols/core/Seat.hpp b/src/protocols/core/Seat.hpp
index 35839385..0c14e52a 100644
--- a/src/protocols/core/Seat.hpp
+++ b/src/protocols/core/Seat.hpp
@@ -142,7 +142,7 @@ class CWLSeatResource {
WP<CWLSeatResource> m_self;
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
private:
@@ -157,7 +157,7 @@ class CWLSeatProtocol : public IWaylandProtocol {
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
struct {
- CSignal newSeatResource; // SP<CWLSeatResource>
+ CSignalT<SP<CWLSeatResource>> newSeatResource;
} m_events;
private:
diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp
index 8d610fe0..d73525a6 100644
--- a/src/protocols/core/Shm.cpp
+++ b/src/protocols/core/Shm.cpp
@@ -24,7 +24,7 @@ CWLSHMBuffer::CWLSHMBuffer(SP<CWLSHMPoolResource> pool_, uint32_t id, int32_t of
m_resource = CWLBufferResource::create(makeShared<CWlBuffer>(pool_->m_resource->client(), 1, id));
- m_listeners.bufferResourceDestroy = events.destroy.registerListener([this](std::any d) {
+ m_listeners.bufferResourceDestroy = events.destroy.listen([this] {
m_listeners.bufferResourceDestroy.reset();
PROTO::shm->destroyResource(this);
});
diff --git a/src/protocols/core/Subcompositor.cpp b/src/protocols/core/Subcompositor.cpp
index 71058d25..d18d9fc6 100644
--- a/src/protocols/core/Subcompositor.cpp
+++ b/src/protocols/core/Subcompositor.cpp
@@ -71,7 +71,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL
}
});
- m_listeners.commitSurface = m_surface->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.commitSurface = m_surface->m_events.commit.listen([this] {
if (m_surface->m_current.texture && !m_surface->m_mapped) {
m_surface->map();
m_surface->m_events.map.emit();
diff --git a/src/protocols/core/Subcompositor.hpp b/src/protocols/core/Subcompositor.hpp
index cf7913ec..45b84eba 100644
--- a/src/protocols/core/Subcompositor.hpp
+++ b/src/protocols/core/Subcompositor.hpp
@@ -48,7 +48,7 @@ class CWLSubsurfaceResource {
int m_zIndex = 1; // by default, it's above
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
private:
diff --git a/src/protocols/types/Buffer.cpp b/src/protocols/types/Buffer.cpp
index 6608d631..86b37be0 100644
--- a/src/protocols/types/Buffer.cpp
+++ b/src/protocols/types/Buffer.cpp
@@ -36,7 +36,7 @@ void IHLBuffer::onBackendRelease(const std::function<void()>& fn) {
m_backendReleaseQueuedFn = fn;
- m_hlEvents.backendRelease = events.backendRelease.registerListener([this](std::any) {
+ m_hlEvents.backendRelease = events.backendRelease.listen([this] {
if (m_backendReleaseQueuedFn)
m_backendReleaseQueuedFn();
m_backendReleaseQueuedFn = nullptr;
diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp
index b1621de7..1f6a1a6b 100644
--- a/src/protocols/types/DMABuffer.cpp
+++ b/src/protocols/types/DMABuffer.cpp
@@ -15,7 +15,7 @@ using namespace Hyprutils::OS;
CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs const& attrs_) : m_attrs(attrs_) {
g_pHyprRenderer->makeEGLCurrent();
- m_listeners.resourceDestroy = events.destroy.registerListener([this](std::any d) {
+ m_listeners.resourceDestroy = events.destroy.listen([this] {
closeFDs();
m_listeners.resourceDestroy.reset();
});
diff --git a/src/protocols/types/DataDevice.hpp b/src/protocols/types/DataDevice.hpp
index 857d818d..9a9579d3 100644
--- a/src/protocols/types/DataDevice.hpp
+++ b/src/protocols/types/DataDevice.hpp
@@ -41,7 +41,7 @@ class IDataSource {
virtual void sendDndAction(wl_data_device_manager_dnd_action a);
struct {
- CSignal destroy;
+ CSignalT<> destroy;
} m_events;
private:
diff --git a/src/render/Renderbuffer.cpp b/src/render/Renderbuffer.cpp
index addc99a8..da148b9c 100644
--- a/src/render/Renderbuffer.cpp
+++ b/src/render/Renderbuffer.cpp
@@ -48,7 +48,7 @@ CRenderbuffer::CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format) :
m_framebuffer.unbind();
- m_listeners.destroyBuffer = buffer->events.destroy.registerListener([this](std::any d) { g_pHyprRenderer->onRenderbufferDestroy(this); });
+ m_listeners.destroyBuffer = buffer->events.destroy.listen([this] { g_pHyprRenderer->onRenderbufferDestroy(this); });
m_good = true;
}
diff --git a/src/xwayland/XSurface.cpp b/src/xwayland/XSurface.cpp
index d9419794..3b0615a0 100644
--- a/src/xwayland/XSurface.cpp
+++ b/src/xwayland/XSurface.cpp
@@ -42,7 +42,7 @@ CXWaylandSurface::CXWaylandSurface(uint32_t xID_, CBox geometry_, bool OR) : m_x
free(reply);
}
- m_events.resourceChange.registerStaticListener([this](void* data, std::any d) { ensureListeners(); }, nullptr);
+ m_events.resourceChange.listenStatic([this] { ensureListeners(); });
}
void CXWaylandSurface::ensureListeners() {
@@ -52,7 +52,7 @@ void CXWaylandSurface::ensureListeners() {
m_listeners.destroySurface.reset();
m_listeners.commitSurface.reset();
} else if (!connected && m_surface) {
- m_listeners.destroySurface = m_surface->m_events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = m_surface->m_events.destroy.listen([this] {
if (m_mapped)
unmap();
@@ -62,7 +62,7 @@ void CXWaylandSurface::ensureListeners() {
m_events.resourceChange.emit();
});
- m_listeners.commitSurface = m_surface->m_events.commit.registerListener([this](std::any d) {
+ m_listeners.commitSurface = m_surface->m_events.commit.listen([this] {
if (m_surface->m_current.texture && !m_mapped) {
map();
return;
@@ -78,7 +78,7 @@ void CXWaylandSurface::ensureListeners() {
}
if (m_resource) {
- m_listeners.destroyResource = m_resource->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroyResource = m_resource->events.destroy.listen([this] {
unmap();
m_surface.reset();
m_events.resourceChange.emit();
diff --git a/src/xwayland/XSurface.hpp b/src/xwayland/XSurface.hpp
index ec71aad3..10eecbaf 100644
--- a/src/xwayland/XSurface.hpp
+++ b/src/xwayland/XSurface.hpp
@@ -43,20 +43,20 @@ class CXWaylandSurface {
WP<CXWaylandSurfaceResource> m_resource;
struct {
- CSignal stateChanged; // maximized, fs, minimized, etc.
- CSignal metadataChanged; // title, appid
- CSignal destroy;
+ CSignalT<> stateChanged; // maximized, fs, minimized, etc.
+ CSignalT<> metadataChanged; // title, appid
+ CSignalT<> destroy;
- CSignal resourceChange; // associated / dissociated
+ CSignalT<> resourceChange; // associated / dissociated
- CSignal setGeometry;
- CSignal configureRequest; // CBox
+ CSignalT<> setGeometry;
+ CSignalT<CBox> configureRequest;
- CSignal map;
- CSignal unmap;
- CSignal commit;
+ CSignalT<> map;
+ CSignalT<> unmap;
+ CSignalT<> commit;
- CSignal activate;
+ CSignalT<> activate;
} m_events;
struct {
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 2854647d..a2461bb2 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -984,9 +984,8 @@ CXWM::CXWM() : m_connection(makeUnique<CXCBConnection>(g_pXWayland->m_server->m_
setActiveWindow(XCB_WINDOW_NONE);
initSelection();
- m_listeners.newWLSurface = PROTO::compositor->m_events.newSurface.registerListener([this](std::any d) { onNewSurface(std::any_cast<SP<CWLSurfaceResource>>(d)); });
- m_listeners.newXShellSurface =
- PROTO::xwaylandShell->m_events.newSurface.registerListener([this](std::any d) { onNewResource(std::any_cast<SP<CXWaylandSurfaceResource>>(d)); });
+ m_listeners.newWLSurface = PROTO::compositor->m_events.newSurface.listen([this](const auto& surface) { onNewSurface(surface); });
+ m_listeners.newXShellSurface = PROTO::xwaylandShell->m_events.newSurface.listen([this](const auto& surface) { onNewResource(surface); });
createWMWindow();
@@ -1218,12 +1217,12 @@ void CXWM::initSelection() {
createSelectionWindow(m_clipboard.window, "CLIPBOARD_MANAGER");
createSelectionWindow(m_clipboard.window, "CLIPBOARD");
- m_clipboard.listeners.setSelection = g_pSeatManager->m_events.setSelection.registerListener([this](std::any) { m_clipboard.onSelection(); });
- m_clipboard.listeners.keyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.registerListener([this](std::any) { m_clipboard.onKeyboardFocus(); });
+ m_clipboard.listeners.setSelection = g_pSeatManager->m_events.setSelection.listen([this] { m_clipboard.onSelection(); });
+ m_clipboard.listeners.keyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.listen([this] { m_clipboard.onKeyboardFocus(); });
createSelectionWindow(m_primarySelection.window, "PRIMARY");
- m_primarySelection.listeners.setSelection = g_pSeatManager->m_events.setPrimarySelection.registerListener([this](std::any) { m_primarySelection.onSelection(); });
- m_primarySelection.listeners.keyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.registerListener([this](std::any) { m_primarySelection.onKeyboardFocus(); });
+ m_primarySelection.listeners.setSelection = g_pSeatManager->m_events.setPrimarySelection.listen([this] { m_primarySelection.onSelection(); });
+ m_primarySelection.listeners.keyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.listen([this] { m_primarySelection.onKeyboardFocus(); });
createSelectionWindow(m_dndSelection.window, "XdndAware", true);
const uint32_t xdndVersion = XDND_VERSION;