From 068068353982fb8d3e3c0488cb9117a11d860d7a Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 10 Dec 2025 10:22:54 -0600 Subject: [PATCH] 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 --- libweston/input.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libweston/input.c b/libweston/input.c index b37a0cc7f..3cacc798e 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -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; + struct weston_coord_global pos; + + pos = weston_pointer_motion_to_abs(pointer, event); + pos = weston_pointer_clamp(pointer,pos); if (pointer->focus) { - struct weston_coord_global pos; struct weston_coord_surface surf_pos; - pos = weston_pointer_motion_to_abs(pointer, event); 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)) {