From fa4e4a643a678094375751243185afec511552e6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 27 Nov 2013 10:29:32 -0800 Subject: [PATCH] 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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 34fcbc6ac92f2..eeb26c0a3f973 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -496,10 +496,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) #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;