Win32: Ignore WM_MOUSELEAVE in relative mode.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 05 Jun 2013 12:00:15 -0700
changeset 7275 0a6b3b998814
parent 7274 d9ef44d91559
child 7276 37814e7eeff3
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
--- a/src/video/windows/SDL_windowsevents.c	Wed Jun 05 07:22:45 2013 -0700
+++ b/src/video/windows/SDL_windowsevents.c	Wed Jun 05 12:00:15 2013 -0700
@@ -446,14 +446,11 @@
 
 #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;