summaryrefslogtreecommitdiff
path: root/src/xwayland/XWM.cpp
diff options
context:
space:
mode:
authornyx <nnyyxxxx@protonmail.com>2025-02-23 21:52:10 -0500
committerGitHub <noreply@github.com>2025-02-24 03:52:10 +0100
commit3458d7ac93a101ea534ef6d0bcbc32725e267045 (patch)
tree0f1f5d39c59a152e7b01610010d9d0a3005fcc05 /src/xwayland/XWM.cpp
parente59464629fd1b0bdc4505786b8186d759933933c (diff)
xwayland: improve dnd and cleanup (#9405)
Minor changes to xwayland dnd / regular dnd to fix various issues --------- Co-authored-by: Vaxry <vaxry@vaxry.net>
Diffstat (limited to 'src/xwayland/XWM.cpp')
-rw-r--r--src/xwayland/XWM.cpp39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 4ef0389e..02232873 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -1125,20 +1125,22 @@ void CXWM::dissociate(SP<CXWaylandSurface> surf) {
}
void CXWM::updateClientList() {
- std::erase_if(mappedSurfaces, [](const auto& e) { return e.expired() || !e->mapped; });
- std::erase_if(mappedSurfacesStacking, [](const auto& e) { return e.expired() || !e->mapped; });
-
std::vector<xcb_window_t> windows;
- for (auto const& m : mappedSurfaces) {
- windows.push_back(m->xID);
+ windows.reserve(mappedSurfaces.size());
+
+ for (auto const& s : mappedSurfaces) {
+ if (auto surf = s.lock(); surf)
+ windows.push_back(surf->xID);
}
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, screen->root, HYPRATOMS["_NET_CLIENT_LIST"], XCB_ATOM_WINDOW, 32, windows.size(), windows.data());
windows.clear();
+ windows.reserve(mappedSurfacesStacking.size());
- for (auto const& m : mappedSurfacesStacking) {
- windows.push_back(m->xID);
+ for (auto const& s : mappedSurfacesStacking) {
+ if (auto surf = s.lock(); surf)
+ windows.push_back(surf->xID);
}
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, screen->root, HYPRATOMS["_NET_CLIENT_LIST_STACKING"], XCB_ATOM_WINDOW, 32, windows.size(), windows.data());
@@ -1279,29 +1281,6 @@ void CXWM::setCursor(unsigned char* pixData, uint32_t stride, const Vector2D& si
xcb_flush(connection);
}
-void CXWM::sendDndEvent(SP<CWLSurfaceResource> destination, xcb_atom_t type, xcb_client_message_data_t& data) {
- auto XSURF = windowForWayland(destination);
-
- if (!XSURF) {
- Debug::log(ERR, "[xwm] No xwayland surface for destination in sendDndEvent");
- return;
- }
-
- xcb_client_message_event_t event = {
- .response_type = XCB_CLIENT_MESSAGE,
- .format = 32,
- .sequence = 0,
- .window = XSURF->xID,
- .type = type,
- .data = data,
- };
-
- xcb_send_event(g_pXWayland->pWM->connection,
- 0, // propagate
- XSURF->xID, XCB_EVENT_MASK_NO_EVENT, (const char*)&event);
- xcb_flush(g_pXWayland->pWM->connection);
-}
-
SP<CX11DataDevice> CXWM::getDataDevice() {
return dndDataDevice;
}