aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-17 10:18:41 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-11-17 10:18:41 +0000
commitfec035a53fa15c4c8c4e62bfef56a35df4161e38 (patch)
tree24e2a2d0ab86186004e2f7a51a7807168ec77482
parentb91f0f25c7fd84776af2ae6c5683cbd70d060783 (diff)
parentbcf43cdc178ffbd06d0533b6c54e92640817c9c7 (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20171117-pull-request' into staging
sdl2 fixes for 2.11 # gpg: Signature made Fri 17 Nov 2017 10:06:27 GMT # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20171117-pull-request: sdl2: Fix broken display updating after the window is hidden sdl2: Do not leave grab when fullscreen sdl2: Fix dead keyboard after fullsceen sdl2: Use the same pointer show/hide logic for absolute and relative mode sdl2: Do not quit the emulator when an auxilliary window is closed Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-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;
}
}