Fixed large relative mouse motion when iconifying the SDL window.
authorSam Lantinga <slouken@libsdl.org>
Wed, 27 Nov 2013 10:29:32 -0800
changeset 8035 2cc220c7e899
parent 8034 b80feead1d04
child 8036 d485906bd74a
Fixed large relative mouse motion when iconifying the SDL window. Windows will move the window to -32000,-32000 when it is iconified, so we don't want to send mouse motion for iconic windows.
src/video/windows/SDL_windowsevents.c
--- a/src/video/windows/SDL_windowsevents.c	Wed Nov 27 10:29:27 2013 -0800
+++ b/src/video/windows/SDL_windowsevents.c	Wed Nov 27 10:29:32 2013 -0800
@@ -496,10 +496,12 @@
 #ifdef WM_MOUSELEAVE
     case WM_MOUSELEAVE:
         if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode) {
-            POINT cursorPos;
-            GetCursorPos(&cursorPos);
-            ScreenToClient(hwnd, &cursorPos);
-            SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
+            if (!IsIconic(hwnd)) {
+                POINT cursorPos;
+                GetCursorPos(&cursorPos);
+                ScreenToClient(hwnd, &cursorPos);
+                SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
+            }
             SDL_SetMouseFocus(NULL);
         }
         returnCode = 0;