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
This commit is contained in:
parent
6c06aefaf2
commit
c6dd828f1e
1 changed files with 5 additions and 8 deletions
|
@ -446,14 +446,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
#ifdef WM_MOUSELEAVE
|
#ifdef WM_MOUSELEAVE
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
if (SDL_GetMouseFocus() == data->window) {
|
if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode) {
|
||||||
if (!SDL_GetMouse()->relative_mode) {
|
POINT cursorPos;
|
||||||
POINT cursorPos;
|
GetCursorPos(&cursorPos);
|
||||||
GetCursorPos(&cursorPos);
|
ScreenToClient(hwnd, &cursorPos);
|
||||||
ScreenToClient(hwnd, &cursorPos);
|
SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
|
||||||
SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_SetMouseFocus(NULL);
|
SDL_SetMouseFocus(NULL);
|
||||||
}
|
}
|
||||||
returnCode = 0;
|
returnCode = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue