From: havoc Date: Thu, 23 Feb 2012 12:17:32 +0000 (+0000) Subject: use stickmouse code when SDL2 relative mouse fails X-Git-Tag: xonotic-v0.8.0~96^2~300 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=669303ac431ea39cf7ca49bb6e4a014ba880db0d;p=xonotic%2Fdarkplaces.git use stickmouse code when SDL2 relative mouse fails git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11724 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_sdl.c b/vid_sdl.c index b0b05860..88c8e605 100644 --- 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