sdl2 fixes for 2.11

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJaDrSjAAoJEEy22O7T6HE4uUgP/iHa1Po2NFV878ck6f53jC6+
 e/NRwzyGu+KROL1hkSnFoFBF2ASM9ZbyoATKXEXLMDpOAvEP1Yr3smNu10DdH4KN
 YFB639sZTZoCkBxtYAcQGTvgJ6XEe2fMS3Q32Ywd703sqmOaNJjqI8iBltbba090
 hT+sWYfXc+VDESnfUjnDDXX0xlHp6iKX3lp3+fa6H+TPzOuGPjF399SSbAxqItig
 nH/AjQBC19Il/9xLrcduHwWstFw4PvSt8BgcezxVLm53noFT1s5HnnWp7hjbHMWc
 uhlJ20Y46CfcCFOuSuSt5vKhOkq0XwG14pKVFF/DLEa9oI9RI1UBsf9cxMQHOnjz
 PfE4SupDQcjYTi9rScSrDVqjuhVG9k9CRiJozpA559e+9u83XMZhx8jd31nwIZSr
 Hb6PXObPjvIMgL0tt5KGZkTtE2h+RChWd6XOhIniQZ4tjWzi+SrMIH6REd3jZpBp
 3UFv31dJ81bjgjUU+4diREZK0ogb71mvhXOQJM/Ssxnwhi3PreFAvJEhe1pyPgmf
 qtCCe4zjxj1IzJuCow2IvaeRh5f4eXiIwk582KNWMBFc2pNhTpdRCpWdD2xVm+wZ
 JPvOqi1BpakDMe2bRLg06zYbOjzj44gNJWyXKoI9o1ncG8aas9GPxNL1s/eR/cRW
 xlnnVANHdvA0HmwOxe3/
 =G/PC
 -----END PGP SIGNATURE-----

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>
master
Peter Maydell 2017-11-17 10:18:41 +00:00
commit fec035a53f
1 changed files with 27 additions and 22 deletions

View File

@ -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;
}
}