Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Win32: Ignore WM_MOUSELEAVE in relative mode.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jorgenpt committed Jun 5, 2013
1 parent 0ee8915 commit 68ef36c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/video/windows/SDL_windowsevents.c
Expand Up @@ -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;
Expand Down

0 comments on commit 68ef36c

Please sign in to comment.