From 703872bccae8fb8244afd2a88f2215baaa6679aa Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 11:45:47 +0200 Subject: [PATCH] xwayland: route keyboard events via wlr_seat_keyboard_notify_enter The XWayland focus path only called wlr_xwayland_surface_activate (X11 focus) but did not notify the wlr_seat about keyboard focus. Without wlr_seat_keyboard_notify_enter, key events were never forwarded to the XWayland surface via the Wayland transport. Now wl_focus_set for XWayland surfaces sets the seat keyboard and calls wlr_seat_keyboard_notify_enter, matching the XDG toplevel path. --- src/backend/wayland/wl_backend.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 02d9344..3297f58 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -5036,10 +5036,18 @@ wl_focus_set(WNativeWindow win, int revert_to, unsigned long timestamp) } struct wl_toplevel_view *v = wl_find_view_by_id(win); if (!v) return; - /* Phase 17: XWayland windows use wlr_xwayland_surface_activate. */ + /* Phase 17: XWayland windows need both X11 focus and Wayland seat focus. */ if (v->xw_surface) { wlr_xwayland_surface_activate(v->xw_surface, true); - wwarning("wl_backend: focus_set(xwayland) id=0x%lx", win); + if (v->xw_surface->surface) { + if (wl_state.keyboard_dev) { + struct wlr_keyboard *kb = wlr_keyboard_from_input_device(wl_state.keyboard_dev); + wlr_seat_set_keyboard(wl_state.seat, kb); + } + wlr_seat_keyboard_notify_enter(wl_state.seat, + v->xw_surface->surface, + NULL, 0, NULL); + } return; } if (!v->xdg_surface || !v->xdg_surface->surface)