]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
input: sdl2: Fix relative mode to match SDL1 behavior
authorCole Robinson <crobinso@redhat.com>
Tue, 1 Apr 2014 20:37:11 +0000 (16:37 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 11 Apr 2014 10:19:16 +0000 (12:19 +0200)
Right now relative mode accelerates too fast, and has the 'invisible wall'
problem. SDL2 added an explicit API to handle this use case, so let's use
it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/sdl2.c

index e4cb9fbba6ff2b04b4d0dac4224d095de274a96a..7506e2e13f2724377b1e6ab4a6bb6100dd08c160 100644 (file)
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -278,7 +278,7 @@ static void sdl_hide_cursor(void)
         SDL_ShowCursor(1);
         SDL_SetCursor(sdl_cursor_hidden);
     } else {
-        SDL_ShowCursor(0);
+        SDL_SetRelativeMouseMode(SDL_TRUE);
     }
 }
 
@@ -289,6 +289,7 @@ static void sdl_show_cursor(void)
     }
 
     if (!qemu_input_is_absolute()) {
+        SDL_SetRelativeMouseMode(SDL_FALSE);
         SDL_ShowCursor(1);
         if (guest_cursor &&
             (gui_grab || qemu_input_is_absolute() || absolute_enabled)) {