core: use new typed signals from hu (#10853)

This commit is contained in:
outfoxxed 2025-07-08 09:56:40 -07:00 committed by GitHub
parent 2f34ef141b
commit 78e9eddfb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
85 changed files with 667 additions and 865 deletions

View file

@ -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);
});

View file

@ -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) {

View file

@ -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;
};
};

View file

@ -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;
});

View file

@ -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");

View file

@ -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)

View file

@ -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_) {

View file

@ -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() {

View file

@ -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);
});

View file

@ -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);
}
}

View file

@ -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:

View file

@ -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();

View file

@ -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;
};
};

View file

@ -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;

View file

@ -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 {

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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() {

View file

@ -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() {

View file

@ -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();

View file

@ -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) {

View file

@ -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() {

View file

@ -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:

View file

@ -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);
});

View file

@ -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:

View file

@ -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;
};
};

View file

@ -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;

View file

@ -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:

View file

@ -148,4 +148,4 @@ void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr
LOGM(LOG, "New VPointer at id {}", id);
m_events.newPointer.emit(RESOURCE);
}
}

View file

@ -15,23 +15,23 @@ class CVirtualPointerV1Resource {
~CVirtualPointerV1Resource();
struct {
CSignal destroy;
CSignal move;
CSignal warp;
CSignal button;
CSignal axis;
CSignal frame;
CSignalT<> destroy;
CSignalT<IPointer::SMotionEvent> move;
CSignalT<IPointer::SMotionAbsoluteEvent> warp;
CSignalT<IPointer::SButtonEvent> button;
CSignalT<IPointer::SAxisEvent> axis;
CSignalT<> frame;
CSignal swipeBegin;
CSignal swipeUpdate;
CSignal swipeEnd;
CSignalT<IPointer::SSwipeBeginEvent> swipeBegin;
CSignalT<IPointer::SSwipeUpdateEvent> swipeUpdate;
CSignalT<IPointer::SSwipeEndEvent> swipeEnd;
CSignal pinchBegin;
CSignal pinchUpdate;
CSignal pinchEnd;
CSignalT<IPointer::SPinchBeginEvent> pinchBegin;
CSignalT<IPointer::SPinchUpdateEvent> pinchUpdate;
CSignalT<IPointer::SPinchEndEvent> pinchEnd;
CSignal holdBegin;
CSignal holdEnd;
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:

View file

@ -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());
}
});

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

@ -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;

View file

@ -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();
}

View file

@ -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:

View file

@ -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);

View file

@ -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:

View file

@ -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);
});

View file

@ -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();

View file

@ -48,7 +48,7 @@ class CWLSubsurfaceResource {
int m_zIndex = 1; // by default, it's above
struct {
CSignal destroy;
CSignalT<> destroy;
} m_events;
private:

View file

@ -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;

View file

@ -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();
});

View file

@ -41,7 +41,7 @@ class IDataSource {
virtual void sendDndAction(wl_data_device_manager_dnd_action a);
struct {
CSignal destroy;
CSignalT<> destroy;
} m_events;
private: