Fix in_nograb not releasing the mouse cursor

Disable SDL relative mouse mode when in_nograb is enabled. Relative
mouse mode hides the cursor and it cannot exit the window regardless
of the window's grab state.

This wasn't always the case. SDL before 2.0.4 on GNU/Linux released
the mouse cursor in relative mode. However, SDL 2.0.3/4 on Windows
does not. (I did not test other Windows versions.) So I think SDL
2.0.4 made GNU/Linux X11 behavior consistent with other platforms.

This fixes mouse input being unusable when debuging client crashes
in gdb.
This commit is contained in:
Zack Middleton 2017-09-10 18:27:50 -05:00
parent a48dcdf224
commit 098d97bdb0
1 changed files with 5 additions and 2 deletions

View File

@ -360,10 +360,13 @@ static void IN_ActivateMouse( void )
{
if( in_nograb->modified || !mouseActive )
{
if( in_nograb->integer )
if( in_nograb->integer ) {
SDL_SetRelativeMouseMode( SDL_FALSE );
SDL_SetWindowGrab( SDL_window, SDL_FALSE );
else
} else {
SDL_SetRelativeMouseMode( SDL_TRUE );
SDL_SetWindowGrab( SDL_window, SDL_TRUE );
}
in_nograb->modified = qfalse;
}