From 8a8aed477d1ca983fb838dbacf6fad9ea36ba2d1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 30 Aug 2023 21:31:19 -0700 Subject: [PATCH] Make sure that we process touch events that position the mouse Fixes https://github.com/libsdl-org/SDL/issues/8176 --- src/events/SDL_mouse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 54fd53d641..ee9d4a2577 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -609,6 +609,13 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ } } + if (mouse->has_position && xrel == 0.0f && yrel == 0.0f) { /* Drop events that don't change state */ +#ifdef DEBUG_MOUSE + SDL_Log("Mouse event didn't change state - dropped!\n"); +#endif + return 0; + } + /* Ignore relative motion positioning the first touch */ if (mouseID == SDL_TOUCH_MOUSEID && !GetButtonState(mouse, SDL_TRUE)) { xrel = 0.0f; @@ -616,13 +623,6 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ } if (mouse->has_position) { - if (xrel == 0.0f && yrel == 0.0f) { /* Drop events that don't change state */ -#ifdef DEBUG_MOUSE - SDL_Log("Mouse event didn't change state - dropped!\n"); -#endif - return 0; - } - /* Update internal mouse coordinates */ if (!mouse->relative_mode) { mouse->x = x;