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.
This commit is contained in:
Ollie 2026-05-30 13:37:15 +02:00
parent 2eef17de24
commit 6e902db869
1 changed files with 7 additions and 0 deletions

View File

@ -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);