From 68ef36c150574aa96ead2435c300762bb8506b25 Mon Sep 17 00:00:00 2001 From: "J?rgen P. Tjern?" Date: Wed, 5 Jun 2013 12:00:15 -0700 Subject: [PATCH] Win32: Ignore WM_MOUSELEAVE in relative mode. We get an WM_MOUSELEAVE when we switch to relative mode, even though the cursor is still in the window. Ignoring this event to not end up with a NULL mouse focus. This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1861 --- src/video/windows/SDL_windowsevents.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index b30b8364b..4ceac554f 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -446,14 +446,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) #ifdef WM_MOUSELEAVE case WM_MOUSELEAVE: - if (SDL_GetMouseFocus() == data->window) { - if (!SDL_GetMouse()->relative_mode) { - POINT cursorPos; - GetCursorPos(&cursorPos); - ScreenToClient(hwnd, &cursorPos); - SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); - } - + 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); SDL_SetMouseFocus(NULL); } returnCode = 0;