From 3a4b7d104ff8bfc14862b7e41bcacb35677306a4 Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@protonmail.com>
Date: Sun, 3 Apr 2022 17:18:05 -0500
Subject: restack xwayland surface on focusclient()

---
 dwl.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dwl.c b/dwl.c
index 0628bfb..b675b67 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1135,6 +1135,15 @@ focusclient(Client *c, int lift)
 		return;
 	}
 
+#ifdef XWAYLAND
+	/* This resolves an issue where the last spawned xwayland client
+	 * receives all pointer activity.
+	 */
+	if (c->type == X11Managed)
+		wlr_xwayland_surface_restack(c->surface.xwayland, NULL,
+				XCB_STACK_MODE_ABOVE);
+#endif
+
 	/* Have a client, so focus its top-level wlr_surface */
 	kb = wlr_seat_get_keyboard(seat);
 	wlr_seat_keyboard_notify_enter(seat, client_surface(c),
-- 
cgit v1.2.3