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 9b5a525a3d

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-11-10 08:12:53 -06:00
parent bf0c99f519
commit 9b7402ece9
1 changed files with 2 additions and 1 deletions

View File

@ -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);