input: Don't refocus clients when pointer moves against boundary

If we don't clamp the input before updating the pointer surface coords,
we'll trigger the "surface jumped beneath us" logic later when the clamp
really happens. That leads to spurious pointer leave/enter events.

Add clamping to weston_pointer_send_motion() to fix this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-12-10 10:22:54 -06:00 committed by Marius Vlad
parent 613558e69e
commit 0680683539

View file

@ -621,12 +621,14 @@ weston_pointer_send_motion(struct weston_pointer *pointer,
wl_fixed_t old_sx;
wl_fixed_t old_sy;
struct weston_view *old_focus = pointer->focus;
if (pointer->focus) {
struct weston_coord_global pos;
struct weston_coord_surface surf_pos;
pos = weston_pointer_motion_to_abs(pointer, event);
pos = weston_pointer_clamp(pointer,pos);
if (pointer->focus) {
struct weston_coord_surface surf_pos;
old_sx = pointer->sx;
old_sy = pointer->sy;
weston_view_update_transform(pointer->focus);
@ -639,7 +641,7 @@ weston_pointer_send_motion(struct weston_pointer *pointer,
old_sy = -1000000;
}
weston_pointer_move(pointer, event);
weston_pointer_move_to_preclamped(pointer, pos);
if (pointer->focus && old_focus == pointer->focus &&
(old_sx != pointer->sx || old_sy != pointer->sy)) {