]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
use stickmouse code when SDL2 relative mouse fails
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Feb 2012 12:17:32 +0000 (12:17 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Feb 2012 12:17:32 +0000 (12:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11724 d7cf8633-e32d-0410-b094-e92efae38249

vid_sdl.c

index b0b05860aa78f7b371fed8d1c9f3e9d3d39656c6..88c8e6055f33903233018eb4ca355b2357525041 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -67,6 +67,7 @@ int cl_available = true;
 qboolean vid_supportrefreshrate = false;
 
 static qboolean vid_usingmouse = false;
+static qboolean vid_usingmouse_relativeworks = false; // SDL2 workaround for unimplemented RelativeMouse mode
 static qboolean vid_usinghidecursor = false;
 static qboolean vid_hasfocus = false;
 static qboolean vid_isfullscreen;
@@ -410,7 +411,8 @@ void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecurso
 #if SDL_MAJOR_VERSION == 1
                SDL_WM_GrabInput( relative ? SDL_GRAB_ON : SDL_GRAB_OFF );
 #else
-               SDL_SetRelativeMouseMode(relative ? SDL_TRUE : SDL_FALSE);
+               vid_usingmouse_relativeworks = SDL_SetRelativeMouseMode(relative ? SDL_TRUE : SDL_FALSE) == 0;
+//             Con_Printf("VID_SetMouse(%i, %i, %i) relativeworks = %i\n", (int)fullscreengrab, (int)relative, (int)hidecursor, (int)vid_usingmouse_relativeworks);
 #endif
 #ifdef MACOSX
                if(relative)
@@ -659,7 +661,7 @@ void IN_Move( void )
        {
                if (vid_usingmouse)
                {
-                       if (vid_stick_mouse.integer)
+                       if (vid_stick_mouse.integer || !vid_usingmouse_relativeworks)
                        {
                                // have the mouse stuck in the middle, example use: prevent expose effect of beryl during the game when not using
                                // window grabbing. --blub