foxygit / doom Log in
commit 904ed263f5f7c36ff12e7c6a527feda1986d4232
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Mon Jan 4 22:55:25 2016 +0100
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Mon Jan 4 22:55:25 2016 +0100

    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.
---
 src/i_video.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 0b5cfdeb..6248b8e0 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -233,13 +233,11 @@ void I_DisplayFPSDots(boolean dots_on)

 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);
     }
 }