From 098d97bdb0cd1d23a02b9c4489766364ac31fb0c Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 10 Sep 2017 18:27:50 -0500 Subject: [PATCH] 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. --- code/sdl/sdl_input.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c index 9514636d..6af67518 100644 --- a/code/sdl/sdl_input.c +++ b/code/sdl/sdl_input.c @@ -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; }