Fixed relative mouse mode with multiple windows. The window cursor clipping will be taken care of when SDL_UpdateWindowGrab() is called.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c
index f7bcc10..1c27095 100644
--- a/src/video/windows/SDL_windowsmouse.c
+++ b/src/video/windows/SDL_windowsmouse.c
@@ -196,44 +196,20 @@ static int
WIN_SetRelativeMouseMode(SDL_bool enabled)
{
RAWINPUTDEVICE rawMouse = { 0x01, 0x02, 0, NULL }; /* Mouse: UsagePage = 1, Usage = 2 */
- HWND hWnd;
- hWnd = GetActiveWindow();
- rawMouse.hwndTarget = hWnd;
- if(!enabled) {
+ if (!enabled) {
rawMouse.dwFlags |= RIDEV_REMOVE;
- rawMouse.hwndTarget = NULL;
}
-
/* (Un)register raw input for mice */
if (RegisterRawInputDevices(&rawMouse, 1, sizeof(RAWINPUTDEVICE)) == FALSE) {
/* Only return an error when registering. If we unregister and fail, then
it's probably that we unregistered twice. That's OK. */
- if(enabled) {
+ if (enabled) {
return SDL_Unsupported();
}
}
-
- if (enabled) {
- LONG cx, cy;
- RECT rect;
- GetWindowRect(hWnd, &rect);
-
- cx = (rect.left + rect.right) / 2;
- cy = (rect.top + rect.bottom) / 2;
-
- /* Make an absurdly small clip rect */
- rect.left = cx-1;
- rect.right = cx+1;
- rect.top = cy-1;
- rect.bottom = cy+1;
-
- ClipCursor(&rect);
- } else {
- ClipCursor(NULL);
- }
return 0;
}