summary refs log tree commit diff stats
path: root/ui/sdl2.c
diff options
context:
space:
mode:
authorJindrich Makovicka <makovick@gmail.com>2017-11-12 20:30:27 +0100
committerGerd Hoffmann <kraxel@redhat.com>2017-11-16 09:57:47 +0100
commit253347e100a6cd142fc88e26c4b4297410e75ddf (patch)
tree31293bbe221d69b1dc8f1d4ff2933fea30632d39 /ui/sdl2.c
parentfc49e7279d71489571a9934a2fee50be3890a888 (diff)
downloadfocaccia-qemu-253347e100a6cd142fc88e26c4b4297410e75ddf.tar.gz
focaccia-qemu-253347e100a6cd142fc88e26c4b4297410e75ddf.zip
sdl2: Use the same pointer show/hide logic for absolute and relative mode
Also use a proper enum parameter for SDL_ShowCursor

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Message-Id: <20171112193032.9724-4-makovick@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl2.c')
-rw-r--r--ui/sdl2.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 05729af971..d0f16f60f4 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -169,10 +169,10 @@ static void sdl_hide_cursor(void)
         return;
     }
 
-    if (qemu_input_is_absolute()) {
-        SDL_ShowCursor(1);
-        SDL_SetCursor(sdl_cursor_hidden);
-    } else {
+    SDL_ShowCursor(SDL_DISABLE);
+    SDL_SetCursor(sdl_cursor_hidden);
+
+    if (!qemu_input_is_absolute()) {
         SDL_SetRelativeMouseMode(SDL_TRUE);
     }
 }
@@ -185,14 +185,16 @@ 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)) {
-            SDL_SetCursor(guest_sprite);
-        } else {
-            SDL_SetCursor(sdl_cursor_normal);
-        }
     }
+
+    if (guest_cursor &&
+        (gui_grab || qemu_input_is_absolute() || absolute_enabled)) {
+        SDL_SetCursor(guest_sprite);
+    } else {
+        SDL_SetCursor(sdl_cursor_normal);
+    }
+
+    SDL_ShowCursor(SDL_ENABLE);
 }
 
 static void sdl_grab_start(struct sdl2_console *scon)