Browse Source

Make sure that we process touch events that position the mouse

Fixes https://github.com/libsdl-org/SDL/issues/8176
Sam Lantinga 1 year ago
parent
commit
8a8aed477d
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/events/SDL_mouse.c

+ 7 - 7
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;