From 1733e3449c67c21c57826cd8a4ae057afe7e3cee Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 09:53:19 +0200 Subject: [PATCH] wl_backend: use map_request signal instead of associate for xwayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The associate signal fires when a wlr_surface is linked to the xwayland surface, but this can happen before or during new_surface processing. map_request fires when the X11 client actually sends MapRequest — at which point WM_CLASS is set and the client is ready to be managed and shown. --- src/backend/wayland/wl_backend.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index f38e08c..4c923da 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -1929,7 +1929,7 @@ handle_xwayland_new_surface(struct wl_listener *listener, void *data) view->title_listener.notify = handle_xwayland_set_class; view->xw_geometry_listener.notify = handle_xwayland_set_geometry; - wl_signal_add(&xw->events.associate, &view->map_listener); + wl_signal_add(&xw->events.map_request, &view->map_listener); wl_signal_add(&xw->events.dissociate, &view->unmap_listener); wl_signal_add(&xw->events.destroy, &view->destroy_listener); wl_signal_add(&xw->events.set_class, &view->title_listener); @@ -1942,12 +1942,8 @@ handle_xwayland_new_surface(struct wl_listener *listener, void *data) 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); - } + * the associate event. Not needed with map_request — the client will + * send MapRequest when ready. */ wwarning("wl_backend: new XWayland surface id=0x%lx class=%s title=%s pos=%d,%d", view->id,