Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Nov 27, 2013
1 parent 2bb344d commit fa4e4a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/video/windows/SDL_windowsevents.c
Expand Up @@ -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;
Expand Down

0 comments on commit fa4e4a6

Please sign in to comment.