From 9b7402ece91b2c928771132ab29f2bec9ae690e1 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 10 Nov 2022 08:12:53 -0600 Subject: [PATCH] input: Don't test uninitialized variables weston_pointer_move() can change the pointer->focus, so we have to ensure we're only testing old_sx and old_sy if we had a focus set before that point. Fixes 9b5a525a3d0 Signed-off-by: Derek Foreman --- libweston/input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libweston/input.c b/libweston/input.c index e9c3f5bcd..cbdc92e95 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -542,6 +542,7 @@ weston_pointer_send_motion(struct weston_pointer *pointer, wl_fixed_t x, y; wl_fixed_t old_sx; wl_fixed_t old_sy; + struct weston_view *old_focus = pointer->focus; if (pointer->focus) { weston_pointer_motion_to_abs(pointer, event, &x, &y); @@ -553,7 +554,7 @@ weston_pointer_send_motion(struct weston_pointer *pointer, weston_pointer_move(pointer, event); - if (pointer->focus && + if (pointer->focus && old_focus == pointer->focus && (old_sx != pointer->sx || old_sy != pointer->sy)) { pointer_send_motion(pointer, time, pointer->sx, pointer->sy);