* [Qemu-devel] [PATCH] Unbreak -no-quit for GTK, validate SDL options
@ 2013-06-11 8:55 Peter Wu
2013-06-11 12:17 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
0 siblings, 1 reply; 2+ messages in thread
From: Peter Wu @ 2013-06-11 8:55 UTC (permalink / raw)
To: Anthony Liguori, qemu-devel, qemu-trivial
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: Peter Wu <lekensteyn@gmail.com>
---
vl.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index cfd2d3e..29ab85c 100644
--- a/vl.c
+++ b/vl.c
@@ -3523,7 +3523,6 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_full_screen:
full_screen = 1;
break;
-#ifdef CONFIG_SDL
case QEMU_OPTION_no_frame:
no_frame = 1;
break;
@@ -3536,14 +3535,11 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_no_quit:
no_quit = 1;
break;
+#ifdef CONFIG_SDL
case QEMU_OPTION_sdl:
display_type = DT_SDL;
break;
#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:
fprintf(stderr, "SDL support is disabled\n");
exit(1);
@@ -4084,6 +4080,15 @@ int main(int argc, char **argv, char **envp)
#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 (display_type == DT_GTK) {
early_gtk_display_init();
--
1.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Unbreak -no-quit for GTK, validate SDL options
2013-06-11 8:55 [Qemu-devel] [PATCH] Unbreak -no-quit for GTK, validate SDL options Peter Wu
@ 2013-06-11 12:17 ` Michael Tokarev
0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2013-06-11 12:17 UTC (permalink / raw)
To: Peter Wu; +Cc: qemu-trivial, Anthony Liguori, qemu-devel
11.06.2013 12:55, Peter Wu wrote:
> 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.
Thanks, this is also something I wanted to do for a long time, -- to know
when some options makes no sense (or not implemented) instead of wondering
what I did wrong and why it does not work as expected... ;)
Applied to the trivial patches queue.
/mjt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-11 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 8:55 [Qemu-devel] [PATCH] Unbreak -no-quit for GTK, validate SDL options Peter Wu
2013-06-11 12:17 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).