fix drag freeze/crash: implicit grab with motion delivery

Preserve pointer focus while buttons are held (implicit grab) to
ensure the client gets the release. Still deliver motion events to
the focused surface so drag and text selection work correctly.
This commit is contained in:
lkn 2026-06-23 13:41:28 +02:00
parent 10389bbba5
commit 311ccfbdd9
1 changed files with 14 additions and 0 deletions

View File

@ -124,6 +124,20 @@ wl_update_pointer_focus(uint32_t time_msec)
if (!wl_state.seat)
return;
/* Preserve implicit grab: don't change focus while buttons are held.
* Still deliver motion to the focused surface for drag/selection. */
if (wl_state.seat->pointer_state.button_count > 0) {
struct wlr_surface *focused = wl_state.seat->pointer_state.focused_surface;
if (focused) {
double sx, sy;
struct wl_toplevel_view *v = NULL;
view_surface_at(wl_state.pointer_x, wl_state.pointer_y, &sx, &sy, &v);
wlr_seat_pointer_notify_motion(wl_state.seat, time_msec, sx, sy);
wlr_seat_pointer_notify_frame(wl_state.seat);
}
return;
}
double sx, sy;
struct wl_toplevel_view *view = NULL;
struct wlr_surface *surface = NULL;