Browse Source

Don't interpret raw input messages with no mouse position

This happens occasionally on touch devices when raw input is enabled
Sam Lantinga 5 years ago
parent
commit
488b94cb40
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/video/windows/SDL_windowsevents.c

+ 1 - 1
src/video/windows/SDL_windowsevents.c

@@ -609,7 +609,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
 
                     if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
                     if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
                         SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
                         SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
-                    } else {
+                    } else if (rawmouse->lLastX || rawmouse->lLastY) {
                         /* synthesize relative moves from the abs position */
                         /* synthesize relative moves from the abs position */
                         static SDL_Point lastMousePoint;
                         static SDL_Point lastMousePoint;
                         SDL_bool virtual_desktop = (rawmouse->usFlags & MOUSE_VIRTUAL_DESKTOP) ? SDL_TRUE : SDL_FALSE;
                         SDL_bool virtual_desktop = (rawmouse->usFlags & MOUSE_VIRTUAL_DESKTOP) ? SDL_TRUE : SDL_FALSE;