diff mbox

[RFC,2/2] input: sdl2: Fix relative mode to match SDL1 behavior

Message ID 69d314c56efa6d68d3cdf0c56344469c0b70c175.1396383249.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson April 1, 2014, 8:37 p.m. UTC
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>
---
While this fixes things for me, I'm not positive it doesn't have other
side effects. I didn't test transition from relative mode to absolute
mode and back, which might hit issues.

 ui/sdl2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/ui/sdl2.c b/ui/sdl2.c
index e4cb9fb..7506e2e 100644
--- 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)) {