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

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