From bbd707d9bc3b342c0ad09fb046911e1595a0b277 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 10 Nov 2022 08:57:02 -0600 Subject: [PATCH] input: fix surface jump test There are two problems here, one is that the surface jump logic only makes sense if the view remains the same. The more important fix is that pointer coordinates are in global coordinates and we want view coordinates, so this test was always wrong and led to an xdg ping storm due to spurious focus changes. Fixes 4d141a788 Signed-off-by: Derek Foreman --- libweston/input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libweston/input.c b/libweston/input.c index cbdc92e95..c84b38030 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -463,9 +463,10 @@ default_grab_pointer_focus(struct weston_pointer_grab *grab) view = weston_compositor_pick_view(pointer->seat->compositor, pointer->x, pointer->y); - if (view) { - weston_view_to_global_fixed(view, pointer->x, pointer->y, - &sx, &sy); + + if (view && view == pointer->focus) { + weston_view_from_global_fixed(view, pointer->x, pointer->y, + &sx, &sy); if (pointer->sx != sx || pointer->sy != sy) surface_jump = true; }