ui: sdl bugfix, -show-cursor deprecation message

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCgAGBQJevlEJAAoJEEy22O7T6HE4yp8P/jgRuXuw2emm2aBF6Hn7/My3
 ZIKZu4UYNjFhYruIrqOsxsbN5Qs1Hkfh0Ab3Wj6Y+65gDwQDRR5BTwyX18+PA2XF
 RWOkF0GKZo4pPt+lcSNEkU58YPb56bUdwnZ5/oP/XX/uAxU0n4h63r0TyVXrzz1X
 wpdX5hjMpcUsFyVbxekOZryVHdT391rdxGcbREwh9yIYbafaPcbZNAvFsHuR3Y2Z
 j3wWUbjDKpVbHOEvW/+bhgqsRzanA7uw/w4i5GrqaDB2dWb4+f7ikaBhm5bhrLjG
 fmsTYSq39jxU6SFCc/ub3jLF5yR9HK0tZvB3vTA30ppOF2L3Qw3v+V6DD8L9+u1m
 fsG0RNDF6RWur930L9jWUWGkG2I+x9Jd+UsNItc4/y4PYlKG3r2/ru2HRGlLl6Mr
 5vC4LHCfjmaE+MkKeTsrllV/3rUc5SYdrd7uPS9Ohpkd/XeKH1hrkU/6Fh00v+CR
 JczNdBYZWVKdOhMNeDwN51jhQfx5I1aLxCRW5/SW6FrrcKJGgy/mWFhHqo+VNYoH
 SfP/eJOQYgRT19Pm37kTlbpDMhR89dAew5Q2e4jTmx86xfZLdZHH8a8YLbtEl53k
 bhVG8g5QiPrD20mQcwowSxHy0+MdzrZYGoC9XV/Ln83MZPgFV4sE0n5XBov+G1Ft
 VONdmcejxZvwM09j6gmQ
 =8rHW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20200515-pull-request' into staging

ui: sdl bugfix, -show-cursor deprecation message

# gpg: Signature made Fri 15 May 2020 09:21:29 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20200515-pull-request:
  ui/sdl2: fix segment fault caused by null pointer dereference
  ui: improve -show-cursor deprecation message

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-05-15 11:18:13 +01:00
commit 2478b8ecd4
2 changed files with 16 additions and 2 deletions

View File

@ -3531,8 +3531,10 @@ void qemu_init(int argc, char **argv, char **envp)
no_shutdown = 1; no_shutdown = 1;
break; break;
case QEMU_OPTION_show_cursor: case QEMU_OPTION_show_cursor:
warn_report("The -show-cursor option is deprecated, " warn_report("The -show-cursor option is deprecated. Please "
"use -display {sdl,gtk},show-cursor=on instead"); "add show-cursor=on to your -display options.");
warn_report("When using the default display you can use "
"-display default,show-cursor=on");
dpy.has_show_cursor = true; dpy.has_show_cursor = true;
dpy.show_cursor = true; dpy.show_cursor = true;
break; break;

View File

@ -332,6 +332,10 @@ static void handle_keydown(SDL_Event *ev)
int gui_key_modifier_pressed = get_mod_state(); int gui_key_modifier_pressed = get_mod_state();
int gui_keysym = 0; int gui_keysym = 0;
if (!scon) {
return;
}
if (!scon->ignore_hotkeys && gui_key_modifier_pressed && !ev->key.repeat) { if (!scon->ignore_hotkeys && gui_key_modifier_pressed && !ev->key.repeat) {
switch (ev->key.keysym.scancode) { switch (ev->key.keysym.scancode) {
case SDL_SCANCODE_2: case SDL_SCANCODE_2:
@ -412,6 +416,10 @@ static void handle_keyup(SDL_Event *ev)
{ {
struct sdl2_console *scon = get_scon_from_window(ev->key.windowID); struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
if (!scon) {
return;
}
scon->ignore_hotkeys = false; scon->ignore_hotkeys = false;
sdl2_process_key(scon, &ev->key); sdl2_process_key(scon, &ev->key);
} }
@ -421,6 +429,10 @@ static void handle_textinput(SDL_Event *ev)
struct sdl2_console *scon = get_scon_from_window(ev->text.windowID); struct sdl2_console *scon = get_scon_from_window(ev->text.windowID);
QemuConsole *con = scon ? scon->dcl.con : NULL; QemuConsole *con = scon ? scon->dcl.con : NULL;
if (!con) {
return;
}
if (qemu_console_is_graphic(con)) { if (qemu_console_is_graphic(con)) {
return; return;
} }