shithub: choc

Download patch

ref: 904ed263f5f7c36ff12e7c6a527feda1986d4232
parent: 5b62ddb6cbd74ad5f12c2324cba9c90bd7060c51
author: Simon Howard <[email protected]>
date: Mon Jan 4 17:55:25 EST 2016

video: Use relative mouse mode, not grab.

SDL_SetWindowGrab() just confines the mouse cursor to the window
and on OS X does not prevent the cursor escaping the window. Relative
mode appears to be the correct solution that provides what we
actually want.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -233,13 +233,11 @@
 
 static void SetShowCursor(boolean show)
 {
-    SDL_ShowCursor(show);
-
-    // When the cursor is hidden, grab the input.
-
     if (!screensaver_mode)
     {
-        SDL_SetWindowGrab(screen, !show);
+        // When the cursor is hidden, grab the input.
+        // Relative mode implicitly hides the cursor.
+        SDL_SetRelativeMouseMode(!show);
     }
 }