From patchwork Fri Jun 14 10:50:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 251335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1FD962C0095 for ; Fri, 14 Jun 2013 20:56:14 +1000 (EST) Received: from localhost ([::1]:37040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRfw-0001b2-1J for incoming@patchwork.ozlabs.org; Fri, 14 Jun 2013 06:56:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRfD-0001WI-QH for qemu-devel@nongnu.org; Fri, 14 Jun 2013 06:55:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnRfA-0005q8-OT for qemu-devel@nongnu.org; Fri, 14 Jun 2013 06:55:27 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:50226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnRfA-0005pe-IB; Fri, 14 Jun 2013 06:55:24 -0400 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id BD0EA41664; Fri, 14 Jun 2013 14:55:23 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id 89EDF51C; Fri, 14 Jun 2013 14:50:47 +0400 (MSK) From: Michael Tokarev To: Anthony Liguori Date: Fri, 14 Jun 2013 14:50:27 +0400 Message-Id: <1371207042-17980-12-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1371207042-17980-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1371207042-17980-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Peter Wu , Michael Tokarev , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 11/26] Unbreak -no-quit for GTK, validate SDL options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Wu 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 Signed-off-by: Michael Tokarev --- vl.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 169c807..9f8fd6e 100644 --- a/vl.c +++ b/vl.c @@ -3524,7 +3524,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; @@ -3537,14 +3536,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); @@ -4085,6 +4081,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();