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

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

View file

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

View file

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