summaryrefslogtreecommitdiff
path: root/src/xwayland/XWM.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/XWM.cpp
parent0e24f9c0d55fcd9a5b2461a865d0e5dc2ea195c8 (diff)
anr: add xwayland support (#9456)
Adds XWayland support to ANR dialogs
Diffstat (limited to 'src/xwayland/XWM.cpp')
-rw-r--r--src/xwayland/XWM.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 0899261a..4ef0389e 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -15,6 +15,7 @@
#include "../protocols/core/Seat.hpp"
#include "../managers/eventLoop/EventLoopManager.hpp"
#include "../managers/SeatManager.hpp"
+#include "../managers/ANRManager.hpp"
#include "../protocols/XWaylandShell.hpp"
#include "../protocols/core/Compositor.hpp"
using namespace Hyprutils::OS;
@@ -283,6 +284,16 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
XSURF->sizeHints->max_height = -1;
}
}
+ } else if (atom == HYPRATOMS["WM_PROTOCOLS"]) {
+ if (reply->type == XCB_ATOM_ATOM) {
+ auto atoms = (xcb_atom_t*)xcb_get_property_value(reply);
+ std::vector<uint32_t> vec;
+ vec.reserve(reply->value_len);
+ for (size_t i = 0; i < reply->value_len; ++i) {
+ vec.emplace_back(atoms[i]);
+ }
+ XSURF->protocols = vec;
+ }
} else {
Debug::log(TRACE, "[xwm] Unhandled prop {} -> {}", atom, propName);
return;
@@ -315,16 +326,14 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) {
if (!XSURF)
return;
- std::string propName = "?";
- for (auto const& ha : HYPRATOMS) {
- if (ha.second != e->type)
- continue;
+ std::string propName = getAtomName(e->type);
- propName = ha.first;
- break;
- }
-
- if (e->type == HYPRATOMS["WL_SURFACE_ID"]) {
+ if (e->type == HYPRATOMS["WM_PROTOCOLS"]) {
+ if (e->data.data32[1] == XSURF->lastPingSeq && e->data.data32[0] == HYPRATOMS["_NET_WM_PING"]) {
+ g_pANRManager->onResponse(XSURF);
+ return;
+ }
+ } else if (e->type == HYPRATOMS["WL_SURFACE_ID"]) {
if (XSURF->surface) {
Debug::log(WARN, "[xwm] Re-assignment of WL_SURFACE_ID");
dissociate(XSURF);
@@ -1056,9 +1065,10 @@ void CXWM::onNewResource(SP<CXWaylandSurfaceResource> resource) {
}
void CXWM::readWindowData(SP<CXWaylandSurface> surf) {
- const std::array<xcb_atom_t, 8> interestingProps = {
+ const std::array<xcb_atom_t, 9> interestingProps = {
XCB_ATOM_WM_CLASS, XCB_ATOM_WM_NAME, XCB_ATOM_WM_TRANSIENT_FOR, HYPRATOMS["WM_HINTS"],
HYPRATOMS["_NET_WM_STATE"], HYPRATOMS["_NET_WM_NAME"], HYPRATOMS["_NET_WM_WINDOW_TYPE"], HYPRATOMS["WM_NORMAL_HINTS"],
+ HYPRATOMS["WM_PROTOCOLS"],
};
for (size_t i = 0; i < interestingProps.size(); i++) {