提交 047d4e15 编写于 作者: P Peter Wu 提交者: Michael Tokarev

Unbreak -no-quit for GTK, validate SDL options

Certain options (-no-frame, -alt-grab, -ctrl-grab) only make sense with SDL.
When compiling without SDL, these options (and -no-quit) print an error message
and exit qemu.

In case QEMU is compiled with SDL support, the three aforementioned options
still do not make sense with other display types. This patch addresses that
issue by printing a warning. I have chosen not to exit QEMU afterwards because
having the option is not harmful and before this patch it would be ignored
anyway.

By delaying the sanity check from compile-time with some ifdefs to run-time,
-no-quit is now also properly supported when compiling without SDL.
Signed-off-by: NPeter Wu <lekensteyn@gmail.com>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 787ba4f0
...@@ -3524,7 +3524,6 @@ int main(int argc, char **argv, char **envp) ...@@ -3524,7 +3524,6 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_full_screen: case QEMU_OPTION_full_screen:
full_screen = 1; full_screen = 1;
break; break;
#ifdef CONFIG_SDL
case QEMU_OPTION_no_frame: case QEMU_OPTION_no_frame:
no_frame = 1; no_frame = 1;
break; break;
...@@ -3537,14 +3536,11 @@ int main(int argc, char **argv, char **envp) ...@@ -3537,14 +3536,11 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_no_quit: case QEMU_OPTION_no_quit:
no_quit = 1; no_quit = 1;
break; break;
#ifdef CONFIG_SDL
case QEMU_OPTION_sdl: case QEMU_OPTION_sdl:
display_type = DT_SDL; display_type = DT_SDL;
break; break;
#else #else
case QEMU_OPTION_no_frame:
case QEMU_OPTION_alt_grab:
case QEMU_OPTION_ctrl_grab:
case QEMU_OPTION_no_quit:
case QEMU_OPTION_sdl: case QEMU_OPTION_sdl:
fprintf(stderr, "SDL support is disabled\n"); fprintf(stderr, "SDL support is disabled\n");
exit(1); exit(1);
...@@ -4085,6 +4081,15 @@ int main(int argc, char **argv, char **envp) ...@@ -4085,6 +4081,15 @@ int main(int argc, char **argv, char **envp)
#endif #endif
} }
if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) {
fprintf(stderr, "-no-frame, -alt-grab and -ctrl-grab are only valid "
"for SDL, ignoring option\n");
}
if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
fprintf(stderr, "-no-quit is only valid for GTK and SDL, "
"ignoring option\n");
}
#if defined(CONFIG_GTK) #if defined(CONFIG_GTK)
if (display_type == DT_GTK) { if (display_type == DT_GTK) {
early_gtk_display_init(); early_gtk_display_init();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册