Fixed relative mouse mode with multiple windows.
authorSam Lantinga <slouken@libsdl.org>
Mon, 24 Feb 2014 22:37:58 -0800
changeset 8252 3e4846dc97b1
parent 8251 833eae6867c2
child 8253 75ad8ebb3768
Fixed relative mouse mode with multiple windows. The window cursor clipping will be taken care of when SDL_UpdateWindowGrab() is called.
src/video/windows/SDL_windowsmouse.c
--- a/src/video/windows/SDL_windowsmouse.c	Mon Feb 24 22:36:24 2014 -0800
+++ b/src/video/windows/SDL_windowsmouse.c	Mon Feb 24 22:37:58 2014 -0800
@@ -196,44 +196,20 @@
 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;
 }