aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/sdl2.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 53dd447fd2..8718cf36b5 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)
@@ -440,6 +442,7 @@ static void handle_keyup(SDL_Event *ev)
sdl2_reset_keys(scon);
return;
}
+ sdl2_reset_keys(scon);
gui_keysym = 0;
}
if (!gui_keysym) {
@@ -468,8 +471,9 @@ static void handle_mousemotion(SDL_Event *ev)
SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);
max_x = scr_w - 1;
max_y = scr_h - 1;
- if (gui_grab && (ev->motion.x == 0 || ev->motion.y == 0 ||
- ev->motion.x == max_x || ev->motion.y == max_y)) {
+ if (gui_grab && !gui_fullscreen
+ && (ev->motion.x == 0 || ev->motion.y == 0 ||
+ ev->motion.x == max_x || ev->motion.y == max_y)) {
sdl_grab_end(scon);
}
if (!gui_grab &&
@@ -566,20 +570,21 @@ static void handle_windowevent(SDL_Event *ev)
update_displaychangelistener(&scon->dcl, 500);
break;
case SDL_WINDOWEVENT_CLOSE:
- if (!no_quit) {
- no_shutdown = 0;
- qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+ if (qemu_console_is_graphic(scon->dcl.con)) {
+ if (!no_quit) {
+ no_shutdown = 0;
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+ }
+ } else {
+ SDL_HideWindow(scon->real_window);
+ scon->hidden = true;
}
break;
case SDL_WINDOWEVENT_SHOWN:
- if (scon->hidden) {
- SDL_HideWindow(scon->real_window);
- }
+ scon->hidden = false;
break;
case SDL_WINDOWEVENT_HIDDEN:
- if (!scon->hidden) {
- SDL_ShowWindow(scon->real_window);
- }
+ scon->hidden = true;
break;
}
}