summaryrefslogtreecommitdiff
path: root/src/xwayland/XSurface.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-02-21 21:26:53 +0100
committerGitHub <noreply@github.com>2025-02-21 21:26:53 +0100
commitf4b148df1e2d8edc96bd878a4cfde32ca6515ac8 (patch)
treec8c4976280c0bbf450b572df33f312bdb6caab44 /src/xwayland/XSurface.cpp
parent0e24f9c0d55fcd9a5b2461a865d0e5dc2ea195c8 (diff)
anr: add xwayland support (#9456)
Adds XWayland support to ANR dialogs
Diffstat (limited to 'src/xwayland/XSurface.cpp')
-rw-r--r--src/xwayland/XSurface.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/xwayland/XSurface.cpp b/src/xwayland/XSurface.cpp
index 91f20be5..b297c29c 100644
--- a/src/xwayland/XSurface.cpp
+++ b/src/xwayland/XSurface.cpp
@@ -2,6 +2,7 @@
#include "XWayland.hpp"
#include "../protocols/XWaylandShell.hpp"
#include "../protocols/core/Compositor.hpp"
+#include "../managers/ANRManager.hpp"
#ifndef NO_XWAYLAND
@@ -243,6 +244,28 @@ void CXWaylandSurface::setWithdrawn(bool withdrawn_) {
xcb_change_property(g_pXWayland->pWM->connection, XCB_PROP_MODE_REPLACE, xID, HYPRATOMS["WM_STATE"], HYPRATOMS["WM_STATE"], 32, props.size(), props.data());
}
+void CXWaylandSurface::ping() {
+ bool supportsPing = std::ranges::find(protocols, HYPRATOMS["_NET_WM_PING"]) != protocols.end();
+
+ if (!supportsPing) {
+ Debug::log(TRACE, "CXWaylandSurface: XID {} does not support ping, just sending an instant reply", xID);
+ g_pANRManager->onResponse(self.lock());
+ return;
+ }
+
+ timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+
+ xcb_client_message_data_t msg = {};
+ msg.data32[0] = HYPRATOMS["_NET_WM_PING"];
+ msg.data32[1] = now.tv_sec * 1000 + now.tv_nsec / 1000000;
+ msg.data32[2] = xID;
+
+ lastPingSeq = msg.data32[1];
+
+ g_pXWayland->pWM->sendWMMessage(self.lock(), &msg, XCB_EVENT_MASK_PROPERTY_CHANGE);
+}
+
#else
CXWaylandSurface::CXWaylandSurface(uint32_t xID_, CBox geometry_, bool OR) : xID(xID_), geometry(geometry_), overrideRedirect(OR) {
@@ -297,4 +320,8 @@ void CXWaylandSurface::setWithdrawn(bool withdrawn) {
;
}
+void CXWaylandSurface::ping() {
+ ;
+}
+
#endif