From 6e902db8694e905dbb58a8f844e96e10340008fb Mon Sep 17 00:00:00 2001 From: Ollie Date: Sat, 30 May 2026 13:37:15 +0200 Subject: [PATCH] fix: refresh pointer focus before delivering button event on Wayland wlr_seat_pointer_notify_button delivers to the surface that currently has pointer focus. If the last wl_update_pointer_focus call was during a motion event that targeted a different area (e.g., titlebar), the XWayland client surface might not have focus when the user clicks on its content area. Added wl_update_pointer_focus call before wlr_seat_pointer_notify_button in handle_pointer_button to ensure pointer focus is always current. --- src/backend/wayland/wl_backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 062c5f6..475274b 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -6341,6 +6341,13 @@ handle_pointer_button(struct wl_listener *listener, void *data) W_WL_EnqueueEvent(wmscr, &wev, target); } + /* Refresh pointer focus before delivering button event. + * The last wl_update_pointer_focus call was during the most recent + * motion event. If no motion happened since then, the XWayland + * surface might not have pointer focus, causing + * wlr_seat_pointer_notify_button to be a no-op. */ + wl_update_pointer_focus(ev->time_msec); + wlr_seat_pointer_notify_button(wl_state.seat, ev->time_msec, ev->button, ev->state); wlr_seat_pointer_notify_frame(wl_state.seat);