From 72a592a402456647dc8700391fc502f91cda6f07 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 09:48:42 +0200 Subject: [PATCH] wl_backend: handle already-associated xwayland surfaces If the xwayland surface already has a wlr_surface when we register listeners (associate event already fired), trigger the map handler directly. This fixes xterm and other X11 clients that associate their surface before the new_surface handler runs. --- src/backend/wayland/wl_backend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index ee70a5f..f38e08c 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -1941,6 +1941,14 @@ handle_xwayland_new_surface(struct wl_listener *listener, void *data) view->x = (wl_state.output ? (int)wl_state.output->width : 1920) / 4; view->y = (wl_state.output ? (int)wl_state.output->height : 1080) / 4; + /* If the surface is already associated (has a wlr_surface), we missed + * the associate event. Trigger the map handler directly. */ + if (xw->surface) { + wwarning("wl_backend: xwayland surface 0x%x already associated, triggering map", + (unsigned)xw->window_id); + view->map_listener.notify(&view->map_listener, NULL); + } + wwarning("wl_backend: new XWayland surface id=0x%lx class=%s title=%s pos=%d,%d", view->id, xw->class ? xw->class : "(none)",