From patchwork Fri Feb 2 11:10:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0Q41xl1z9sRW for ; Sat, 3 Feb 2018 01:54:51 +1100 (AEDT) Received: from localhost ([::1]:35872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcjp-0000od-Rc for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 09:54:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcca-0003iP-5p for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehccV-0004n6-9j for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehccV-0004lA-31 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2AB9C05E764 for ; Fri, 2 Feb 2018 11:10:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BFAA78E9C; Fri, 2 Feb 2018 11:10:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BD4C5960; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:11 +0100 Message-Id: <20180202111022.19269-2-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 02 Feb 2018 11:10:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 01/12] vl: deprecate -no-frame X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- vl.c | 4 ++++ qemu-doc.texi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/vl.c b/vl.c index e517a8d995..ac0efca708 100644 --- a/vl.c +++ b/vl.c @@ -2104,6 +2104,8 @@ static DisplayType select_display(const char *p) const char *nextopt; if (strstart(opts, ",frame=", &nextopt)) { + g_printerr("The frame= sdl option is deprecated, and will be\n" + "removed in a future release.\n"); opts = nextopt; if (strstart(opts, "on", &nextopt)) { no_frame = 0; @@ -3642,6 +3644,8 @@ int main(int argc, char **argv, char **envp) full_screen = 1; break; case QEMU_OPTION_no_frame: + g_printerr("The -no-frame switch is deprecated, and will be\n" + "removed in a future release.\n"); no_frame = 1; break; case QEMU_OPTION_alt_grab: diff --git a/qemu-doc.texi b/qemu-doc.texi index 19a82bfea3..aa7180a3d9 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2749,6 +2749,13 @@ filesystem test suite. Also it requires the CAP_DAC_READ_SEARCH capability, which is not the recommended way to run QEMU. This backend should not be used and it will be removed with no replacement. +@subsection -no-frame (since 2.12.0) + +The ``-no-frame'' argument works with SDL 1.2 only. SDL 2.0 lacks +support for frameless windows, and the other user interfaces never +implemented this in the first place. So this will be removed together +with SDL 1.2 support. + @section qemu-img command line arguments @subsection convert -s (since 2.0.0) From patchwork Fri Feb 2 11:10:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868614 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0cK463zz9t20 for ; Sat, 3 Feb 2018 02:03:45 +1100 (AEDT) Received: from localhost ([::1]:35992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcsR-0000VQ-KF for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:03:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcca-0003iM-5J for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehccV-0004n1-9f for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehccV-0004l8-3N for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF7CFC05E744 for ; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACE525191D; Fri, 2 Feb 2018 11:10:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C6A5F6DC; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:12 +0100 Message-Id: <20180202111022.19269-3-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 02 Feb 2018 11:10:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 02/12] vl: deprecate -alt-grab and -ctrl-grab X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- vl.c | 8 ++++++++ qemu-doc.texi | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/vl.c b/vl.c index ac0efca708..fa19a61500 100644 --- a/vl.c +++ b/vl.c @@ -2115,6 +2115,8 @@ static DisplayType select_display(const char *p) goto invalid_sdl_args; } } else if (strstart(opts, ",alt_grab=", &nextopt)) { + g_printerr("The alt_grab= sdl option is deprecated, and will be\n" + "removed in a future release.\n"); opts = nextopt; if (strstart(opts, "on", &nextopt)) { alt_grab = 1; @@ -2124,6 +2126,8 @@ static DisplayType select_display(const char *p) goto invalid_sdl_args; } } else if (strstart(opts, ",ctrl_grab=", &nextopt)) { + g_printerr("The ctrl_grab= sdl option is deprecated, and will be\n" + "removed in a future release.\n"); opts = nextopt; if (strstart(opts, "on", &nextopt)) { ctrl_grab = 1; @@ -3649,9 +3653,13 @@ int main(int argc, char **argv, char **envp) no_frame = 1; break; case QEMU_OPTION_alt_grab: + g_printerr("The -alt-grab switch is deprecated, and will be\n" + "removed in a future release.\n"); alt_grab = 1; break; case QEMU_OPTION_ctrl_grab: + g_printerr("The -ctrl-grab switch is deprecated, and will be\n" + "removed in a future release.\n"); ctrl_grab = 1; break; case QEMU_OPTION_no_quit: diff --git a/qemu-doc.texi b/qemu-doc.texi index aa7180a3d9..5961c7a211 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2756,6 +2756,12 @@ support for frameless windows, and the other user interfaces never implemented this in the first place. So this will be removed together with SDL 1.2 support. +@subsection -alt-grab and -ctrl-grab (since 2.12.0) + +The ``-alt-grab'' and ``-ctrl-grab'' arguments are deprecated. They +work with SDL only. They will eventually replaced with a new way to +configure hotkeys which works consistently across all user interfaces. + @section qemu-img command line arguments @subsection convert -s (since 2.0.0) From patchwork Fri Feb 2 11:10:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868626 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0xK2WB3z9s4s for ; Sat, 3 Feb 2018 02:18:29 +1100 (AEDT) Received: from localhost ([::1]:36281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd6h-0004hH-Aq for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:18:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcfn-0006XF-Hy for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcfZ-0006pb-BY for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehcfZ-0006pD-1L for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:25 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D38F387628 for ; Fri, 2 Feb 2018 11:10:30 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0F1160C23; Fri, 2 Feb 2018 11:10:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CED6A31FFF; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:13 +0100 Message-Id: <20180202111022.19269-4-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 02 Feb 2018 11:10:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 03/12] vl: rename DisplayType to LegacyDisplayType X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" qapi DisplayType will replace the current enum. For the transition both will coexist though, so rename it so we don't have a name clash. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- vl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index fa19a61500..a2478412c7 100644 --- a/vl.c +++ b/vl.c @@ -2082,7 +2082,7 @@ static void select_vgahw(const char *p) } } -typedef enum DisplayType { +typedef enum LegacyDisplayType { DT_DEFAULT, DT_CURSES, DT_SDL, @@ -2090,12 +2090,12 @@ typedef enum DisplayType { DT_GTK, DT_EGL, DT_NONE, -} DisplayType; +} LegacyDisplayType; -static DisplayType select_display(const char *p) +static LegacyDisplayType select_display(const char *p) { const char *opts; - DisplayType display = DT_DEFAULT; + LegacyDisplayType display = DT_DEFAULT; if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL @@ -3058,7 +3058,7 @@ int main(int argc, char **argv, char **envp) const char *incoming = NULL; bool userconfig = true; bool nographic = false; - DisplayType display_type = DT_DEFAULT; + LegacyDisplayType display_type = DT_DEFAULT; int display_remote = 0; const char *log_mask = NULL; const char *log_file = NULL; From patchwork Fri Feb 2 11:10:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY1110gmYz9s4s for ; Sat, 3 Feb 2018 02:21:41 +1100 (AEDT) Received: from localhost ([::1]:36321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd9n-0007We-53 for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:21:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcem-0005VY-8e for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcei-00060x-1t for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46030) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehceh-000608-Nd for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9BA7A80E45 for ; Fri, 2 Feb 2018 11:10:24 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC96B619F2; Fri, 2 Feb 2018 11:10:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA36440BF4; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:14 +0100 Message-Id: <20180202111022.19269-5-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Feb 2018 11:10:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 04/12] gtk: add and use DisplayOptions + DisplayGTK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add QAPI DisplayType enum, DisplayOptions union and DisplayGTK struct. Switch gtk configuration to use the qapi type. Some bookkeeping (fullscreen for example) is done twice now, this is temporary until more/all UIs are switched over to qapi configuration. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- include/ui/console.h | 9 ++++---- ui/gtk.c | 32 ++++++++++++++++------------- vl.c | 23 ++++++++++++++++----- qapi/ui.json | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 24 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 7b35778444..58d1a3d27c 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -511,18 +511,17 @@ int index_from_key(const char *key, size_t key_length); /* gtk.c */ #ifdef CONFIG_GTK -void early_gtk_display_init(int opengl); -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover); +void early_gtk_display_init(DisplayOptions *opts); +void gtk_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void gtk_display_init(DisplayState *ds, bool full_screen, - bool grab_on_hover) +static inline void gtk_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_GTK is disabled */ error_report("GTK support is disabled"); abort(); } -static inline void early_gtk_display_init(int opengl) +static inline void early_gtk_display_init(DisplayOptions *opts) { /* This must never be called if CONFIG_GTK is disabled */ error_report("GTK support is disabled"); diff --git a/ui/gtk.c b/ui/gtk.c index f0ad63e431..c12d5e020c 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -229,6 +229,8 @@ struct GtkDisplayState { bool modifier_pressed[ARRAY_SIZE(modifier_keycode)]; bool ignore_keys; + + DisplayOptions *opts; }; typedef struct VCChardev { @@ -777,9 +779,14 @@ static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event, void *opaque) { GtkDisplayState *s = opaque; + bool allow_close = true; int i; - if (!no_quit) { + if (s->opts->has_window_close && !s->opts->window_close) { + allow_close = false; + } + + if (allow_close) { for (i = 0; i < s->nb_vcs; i++) { if (s->vc[i].type != GD_VC_GFX) { continue; @@ -2289,7 +2296,7 @@ static void gd_create_menus(GtkDisplayState *s) static gboolean gtkinit; -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) +void gtk_display_init(DisplayState *ds, DisplayOptions *opts) { VirtualConsole *vc; @@ -2301,6 +2308,8 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) fprintf(stderr, "gtk initialization failed\n"); exit(1); } + assert(opts->type == DISPLAY_TYPE_GTK); + s->opts = opts; #if !GTK_CHECK_VERSION(3, 0, 0) g_printerr("Running QEMU with GTK 2.x is deprecated, and will be removed\n" @@ -2387,15 +2396,17 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) vc && vc->type == GD_VC_VTE); #endif - if (full_screen) { + if (opts->has_full_screen && + opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); } - if (grab_on_hover) { + if (opts->u.gtk.has_grab_on_hover && + opts->u.gtk.grab_on_hover) { gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item)); } } -void early_gtk_display_init(int opengl) +void early_gtk_display_init(DisplayOptions *opts) { /* The QEMU code relies on the assumption that it's always run in * the C locale. Therefore it is not prepared to deal with @@ -2421,11 +2432,8 @@ void early_gtk_display_init(int opengl) return; } - switch (opengl) { - case -1: /* default */ - case 0: /* off */ - break; - case 1: /* on */ + assert(opts->type == DISPLAY_TYPE_GTK); + if (opts->has_gl && opts->gl) { #if defined(CONFIG_OPENGL) #if defined(CONFIG_GTK_GL) gtk_gl_area_init(); @@ -2433,10 +2441,6 @@ void early_gtk_display_init(int opengl) gtk_egl_init(); #endif #endif - break; - default: - g_assert_not_reached(); - break; } keycode_map = gd_get_keymap(&keycode_maplen); diff --git a/vl.c b/vl.c index a2478412c7..4a555de0cf 100644 --- a/vl.c +++ b/vl.c @@ -150,9 +150,9 @@ static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; static int full_screen = 0; +static DisplayOptions dpy; int no_frame; int no_quit = 0; -static bool grab_on_hover; Chardev *serial_hds[MAX_SERIAL_PORTS]; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES]; @@ -2191,24 +2191,29 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "gtk", &opts)) { #ifdef CONFIG_GTK display = DT_GTK; + dpy.type = DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; if (strstart(opts, ",grab_on_hover=", &nextopt)) { opts = nextopt; + dpy.u.gtk.has_grab_on_hover = true; if (strstart(opts, "on", &nextopt)) { - grab_on_hover = true; + dpy.u.gtk.grab_on_hover = true; } else if (strstart(opts, "off", &nextopt)) { - grab_on_hover = false; + dpy.u.gtk.grab_on_hover = false; } else { goto invalid_gtk_args; } } else if (strstart(opts, ",gl=", &nextopt)) { opts = nextopt; + dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { request_opengl = 1; + dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { request_opengl = 0; + dpy.gl = false; } else { goto invalid_gtk_args; } @@ -2225,6 +2230,7 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "none", &opts)) { display = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; } else { error_report("unknown display type"); exit(1); @@ -3259,6 +3265,7 @@ int main(int argc, char **argv, char **envp) qemu_opts_parse_noisily(olist, "graphics=off", false); nographic = true; display_type = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: #ifdef CONFIG_CURSES @@ -3646,6 +3653,8 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_full_screen: full_screen = 1; + dpy.has_full_screen = true; + dpy.full_screen = true; break; case QEMU_OPTION_no_frame: g_printerr("The -no-frame switch is deprecated, and will be\n" @@ -3664,6 +3673,8 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_no_quit: no_quit = 1; + dpy.has_window_close = true; + dpy.window_close = false; break; case QEMU_OPTION_sdl: #ifdef CONFIG_SDL @@ -4331,6 +4342,7 @@ int main(int argc, char **argv, char **envp) if (display_type == DT_DEFAULT && !display_remote) { #if defined(CONFIG_GTK) display_type = DT_GTK; + dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) display_type = DT_SDL; #elif defined(CONFIG_COCOA) @@ -4339,6 +4351,7 @@ int main(int argc, char **argv, char **envp) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else display_type = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; #endif } @@ -4352,7 +4365,7 @@ int main(int argc, char **argv, char **envp) } if (display_type == DT_GTK) { - early_gtk_display_init(request_opengl); + early_gtk_display_init(&dpy); } if (display_type == DT_SDL) { @@ -4697,7 +4710,7 @@ int main(int argc, char **argv, char **envp) cocoa_display_init(ds, full_screen); break; case DT_GTK: - gtk_display_init(ds, full_screen, grab_on_hover); + gtk_display_init(ds, &dpy); break; default: break; diff --git a/qapi/ui.json b/qapi/ui.json index 07b468f625..bdb166a608 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -982,3 +982,61 @@ 'data': { '*device': 'str', '*head' : 'int', 'events' : [ 'InputEvent' ] } } + + +## +# @DisplayNoOpts: +# +# Empty struct for displays without config options. +# +# Since: 2.12 +# +## +{ 'struct' : 'DisplayNoOpts', + 'data' : { } } + +## +# @DisplayGTK: +# +# GTK display options. +# +# @grab-on-hover: Grab keyboard input on mouse hover. +# +# Since: 2.12 +# +## +{ 'struct' : 'DisplayGTK', + 'data' : { '*grab-on-hover' : 'bool' } } + +## +# @DisplayType: +# +# Display (user interface) type. +# +# Since: 2.12 +# +## +{ 'enum' : 'DisplayType', + 'data' : [ 'none', 'gtk' ] } + +## +# @DisplayOptions: +# +# Display (user interface) options. +# +# @type: Which DisplayType qemu should use. +# @full-screen: Start user interface in fullscreen mode (default: off). +# @window-close: Allow to quit qemu with window close button (default: on). +# @gl: Enable OpenGL support (default: off). +# +# Since: 2.12 +# +## +{ 'union' : 'DisplayOptions', + 'base' : { 'type' : 'DisplayType', + '*full-screen' : 'bool', + '*window-close' : 'bool', + '*gl' : 'bool' }, + 'discriminator' : 'type', + 'data' : { 'none' : 'DisplayNoOpts', + 'gtk' : 'DisplayGTK' } } From patchwork Fri Feb 2 11:10:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0wB041Kz9s4s for ; Sat, 3 Feb 2018 02:17:30 +1100 (AEDT) Received: from localhost ([::1]:36264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd5k-0003pT-23 for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:17:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcfE-00062R-3A for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcfA-0006TJ-36 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehcf9-0006Sr-RZ for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:00 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA20A4E4C5 for ; Fri, 2 Feb 2018 11:10:32 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 694D667DC8; Fri, 2 Feb 2018 11:10:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E639E422ED; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:15 +0100 Message-Id: <20180202111022.19269-6-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 02 Feb 2018 11:10:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 05/12] sdl: use DisplayOptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch sdl ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- include/ui/console.h | 8 ++++---- ui/sdl.c | 19 +++++++++++++------ ui/sdl2.c | 33 +++++++++++++++++++-------------- vl.c | 13 +++++++++++-- qapi/ui.json | 5 +++-- 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 58d1a3d27c..deee5bb606 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -435,16 +435,16 @@ void surface_gl_setup_viewport(QemuGLShader *gls, /* sdl.c */ #ifdef CONFIG_SDL -void sdl_display_early_init(int opengl); -void sdl_display_init(DisplayState *ds, int full_screen); +void sdl_display_early_init(DisplayOptions *opts); +void sdl_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void sdl_display_early_init(int opengl) +static inline void sdl_display_early_init(DisplayOptions *opts) { /* This must never be called if CONFIG_SDL is disabled */ error_report("SDL support is disabled"); abort(); } -static inline void sdl_display_init(DisplayState *ds, int full_screen) +static inline void sdl_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_SDL is disabled */ error_report("SDL support is disabled"); diff --git a/ui/sdl.c b/ui/sdl.c index c8f102bb9f..ca27e40299 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -41,6 +41,7 @@ static DisplayChangeListener *dcl; static DisplaySurface *surface; +static DisplayOptions *opts; static SDL_Surface *real_screen; static SDL_Surface *guest_screen = NULL; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -762,6 +763,7 @@ static void handle_activation(SDL_Event *ev) static void sdl_refresh(DisplayChangeListener *dcl) { SDL_Event ev1, *ev = &ev1; + bool allow_close = true; int idle = 1; if (last_vm_running != runstate_is_running()) { @@ -786,7 +788,10 @@ static void sdl_refresh(DisplayChangeListener *dcl) handle_keyup(ev); break; case SDL_QUIT: - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -885,9 +890,9 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_cursor_define = sdl_mouse_define, }; -void sdl_display_early_init(int opengl) +void sdl_display_early_init(DisplayOptions *opts) { - if (opengl == 1 /* on */) { + if (opts->has_gl && opts->gl) { fprintf(stderr, "SDL1 display code has no opengl support.\n" "Please recompile qemu with SDL2, using\n" @@ -895,7 +900,7 @@ void sdl_display_early_init(int opengl) } } -void sdl_display_init(DisplayState *ds, int full_screen) +void sdl_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data = 0; @@ -903,6 +908,8 @@ void sdl_display_init(DisplayState *ds, int full_screen) SDL_SysWMinfo info; char *filename; + assert(o->type == DISPLAY_TYPE_SDL); + opts = o; #if defined(__APPLE__) /* always use generic keymaps */ if (!keyboard_layout) @@ -917,7 +924,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) g_printerr("Running QEMU with SDL 1.2 is deprecated, and will be removed\n" "in a future release. Please switch to SDL 2.0 instead\n"); - if (!full_screen) { + if (opts->has_full_screen && opts->full_screen) { setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } #ifdef __linux__ @@ -960,7 +967,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) g_free(filename); } - if (full_screen) { + if (opts->has_full_screen && opts->full_screen) { gui_fullscreen = 1; sdl_grab_start(); } diff --git a/ui/sdl2.c b/ui/sdl2.c index 812c315891..094782e36c 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -32,6 +32,7 @@ static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; +static DisplayOptions *opts; static SDL_Surface *guest_sprite_surface; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -525,6 +526,7 @@ static void handle_mousewheel(SDL_Event *ev) static void handle_windowevent(SDL_Event *ev) { struct sdl2_console *scon = get_scon_from_window(ev->window.windowID); + bool allow_close = true; if (!scon) { return; @@ -571,7 +573,10 @@ static void handle_windowevent(SDL_Event *ev) break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(scon->dcl.con)) { - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -592,6 +597,7 @@ static void handle_windowevent(SDL_Event *ev) void sdl2_poll_events(struct sdl2_console *scon) { SDL_Event ev1, *ev = &ev1; + bool allow_close = true; int idle = 1; if (scon->last_vm_running != runstate_is_running()) { @@ -614,7 +620,10 @@ void sdl2_poll_events(struct sdl2_console *scon) handle_textinput(ev); break; case SDL_QUIT: - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -749,24 +758,17 @@ static const DisplayChangeListenerOps dcl_gl_ops = { }; #endif -void sdl_display_early_init(int opengl) +void sdl_display_early_init(DisplayOptions *o) { - switch (opengl) { - case -1: /* default */ - case 0: /* off */ - break; - case 1: /* on */ + assert(o->type == DISPLAY_TYPE_SDL); + if (o->has_gl && o->gl) { #ifdef CONFIG_OPENGL display_opengl = 1; #endif - break; - default: - g_assert_not_reached(); - break; } } -void sdl_display_init(DisplayState *ds, int full_screen) +void sdl_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data = 0; @@ -774,6 +776,9 @@ void sdl_display_init(DisplayState *ds, int full_screen) int i; SDL_SysWMinfo info; + assert(o->type == DISPLAY_TYPE_SDL); + opts = o; + #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without * accessible $DISPLAY to open X11 window. This is often the case @@ -848,7 +853,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) g_free(filename); } - if (full_screen) { + if (opts->has_full_screen && opts->full_screen) { gui_fullscreen = 1; sdl_grab_start(0); } diff --git a/vl.c b/vl.c index 4a555de0cf..25e784be63 100644 --- a/vl.c +++ b/vl.c @@ -2100,6 +2100,7 @@ static LegacyDisplayType select_display(const char *p) if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL display = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2138,19 +2139,25 @@ static LegacyDisplayType select_display(const char *p) } } else if (strstart(opts, ",window_close=", &nextopt)) { opts = nextopt; + dpy.has_window_close = true; if (strstart(opts, "on", &nextopt)) { no_quit = 0; + dpy.window_close = true; } else if (strstart(opts, "off", &nextopt)) { no_quit = 1; + dpy.window_close = false; } else { goto invalid_sdl_args; } } else if (strstart(opts, ",gl=", &nextopt)) { opts = nextopt; + dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { request_opengl = 1; + dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { request_opengl = 0; + dpy.gl = false; } else { goto invalid_sdl_args; } @@ -3679,6 +3686,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_sdl: #ifdef CONFIG_SDL display_type = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; break; #else error_report("SDL support is disabled"); @@ -4345,6 +4353,7 @@ int main(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) display_type = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) display_type = DT_COCOA; #elif defined(CONFIG_VNC) @@ -4369,7 +4378,7 @@ int main(int argc, char **argv, char **envp) } if (display_type == DT_SDL) { - sdl_display_early_init(request_opengl); + sdl_display_early_init(&dpy); } qemu_console_early_init(); @@ -4704,7 +4713,7 @@ int main(int argc, char **argv, char **envp) curses_display_init(ds, full_screen); break; case DT_SDL: - sdl_display_init(ds, full_screen); + sdl_display_init(ds, &dpy); break; case DT_COCOA: cocoa_display_init(ds, full_screen); diff --git a/qapi/ui.json b/qapi/ui.json index bdb166a608..52220ed373 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk' ] } + 'data' : [ 'none', 'gtk', 'sdl' ] } ## # @DisplayOptions: @@ -1039,4 +1039,5 @@ '*gl' : 'bool' }, 'discriminator' : 'type', 'data' : { 'none' : 'DisplayNoOpts', - 'gtk' : 'DisplayGTK' } } + 'gtk' : 'DisplayGTK', + 'sdl' : 'DisplayNoOpts' } } From patchwork Fri Feb 2 11:10:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0YN1jVnz9sRW for ; Sat, 3 Feb 2018 02:01:12 +1100 (AEDT) Received: from localhost ([::1]:35979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcpy-0006fo-8Q for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:01:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehccd-0003nM-PK for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehccd-0004x5-2J for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehccc-0004vw-RZ for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1951BDC1 for ; Fri, 2 Feb 2018 11:10:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6ADEA79164; Fri, 2 Feb 2018 11:10:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EE465422FF; Fri, 2 Feb 2018 12:10:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:16 +0100 Message-Id: <20180202111022.19269-7-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 02 Feb 2018 11:10:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 06/12] vl: drop no_quit variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Not used any more, delete it. Signed-off-by: Gerd Hoffmann --- vl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 25e784be63..c17dedfa4e 100644 --- a/vl.c +++ b/vl.c @@ -152,7 +152,6 @@ int vga_interface_type = VGA_NONE; static int full_screen = 0; static DisplayOptions dpy; int no_frame; -int no_quit = 0; Chardev *serial_hds[MAX_SERIAL_PORTS]; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES]; @@ -2141,10 +2140,8 @@ static LegacyDisplayType select_display(const char *p) opts = nextopt; dpy.has_window_close = true; if (strstart(opts, "on", &nextopt)) { - no_quit = 0; dpy.window_close = true; } else if (strstart(opts, "off", &nextopt)) { - no_quit = 1; dpy.window_close = false; } else { goto invalid_sdl_args; @@ -3679,7 +3676,6 @@ int main(int argc, char **argv, char **envp) ctrl_grab = 1; break; case QEMU_OPTION_no_quit: - no_quit = 1; dpy.has_window_close = true; dpy.window_close = false; break; @@ -4368,7 +4364,8 @@ int main(int argc, char **argv, char **envp) error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); } - if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) { + if (dpy.has_window_close && + (display_type != DT_GTK && display_type != DT_SDL)) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); } From patchwork Fri Feb 2 11:10:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0yb3n42z9s4s for ; Sat, 3 Feb 2018 02:19:35 +1100 (AEDT) Received: from localhost ([::1]:36285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd7l-0005ZT-H1 for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:19:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcfn-0006XM-Jy for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcfZ-0006pf-CA for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehcfZ-0006pB-1S for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:50:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A82187624 for ; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E55518A5A; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 053D342300; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:17 +0100 Message-Id: <20180202111022.19269-8-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 02 Feb 2018 11:10:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 07/12] egl-headless: use DisplayOptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch egl-headless ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- include/ui/console.h | 2 +- ui/egl-headless.c | 2 +- vl.c | 3 ++- qapi/ui.json | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index deee5bb606..4cb623112e 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -530,6 +530,6 @@ static inline void early_gtk_display_init(DisplayOptions *opts) #endif /* egl-headless.c */ -void egl_headless_init(void); +void egl_headless_init(DisplayOptions *opts); #endif diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 5d50226869..38b3766548 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -154,7 +154,7 @@ static const DisplayChangeListenerOps egl_ops = { .dpy_gl_update = egl_scanout_flush, }; -void egl_headless_init(void) +void egl_headless_init(DisplayOptions *opts) { QemuConsole *con; egl_dpy *edpy; diff --git a/vl.c b/vl.c index c17dedfa4e..1d801dd96d 100644 --- a/vl.c +++ b/vl.c @@ -2181,6 +2181,7 @@ static LegacyDisplayType select_display(const char *p) request_opengl = 1; display_opengl = 1; display = DT_EGL; + dpy.type = DISPLAY_TYPE_EGL_HEADLESS; #else fprintf(stderr, "egl support is disabled\n"); exit(1); @@ -4737,7 +4738,7 @@ int main(int argc, char **argv, char **envp) #ifdef CONFIG_OPENGL_DMABUF if (display_type == DT_EGL) { - egl_headless_init(); + egl_headless_init(&dpy); } #endif diff --git a/qapi/ui.json b/qapi/ui.json index 52220ed373..cc489b7856 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk', 'sdl' ] } + 'data' : [ 'none', 'gtk', 'sdl', 'egl-headless' ] } ## # @DisplayOptions: @@ -1040,4 +1040,5 @@ 'discriminator' : 'type', 'data' : { 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', - 'sdl' : 'DisplayNoOpts' } } + 'sdl' : 'DisplayNoOpts', + 'egl-headless' : 'DisplayNoOpts' } } From patchwork Fri Feb 2 11:10:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0Tj3sqNz9sRW for ; Sat, 3 Feb 2018 01:58:01 +1100 (AEDT) Received: from localhost ([::1]:35911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcmt-0003eP-Fm for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 09:57:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcca-0003iS-6C for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehccV-0004nC-BU for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehccV-0004l9-33 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:15 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02247C05E769 for ; Fri, 2 Feb 2018 11:10:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6B816BF73; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 103704F278; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:18 +0100 Message-Id: <20180202111022.19269-9-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 02 Feb 2018 11:10:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 08/12] curses: use DisplayOptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch curses ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- include/ui/console.h | 4 ++-- ui/curses.c | 2 +- vl.c | 4 +++- qapi/ui.json | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 4cb623112e..9749503aa7 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -496,9 +496,9 @@ static inline int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp) /* curses.c */ #ifdef CONFIG_CURSES -void curses_display_init(DisplayState *ds, int full_screen); +void curses_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void curses_display_init(DisplayState *ds, int full_screen) +static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_CURSES is disabled */ error_report("curses support is disabled"); diff --git a/ui/curses.c b/ui/curses.c index 85503876c0..479b77bd03 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -434,7 +434,7 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_text_cursor = curses_cursor_position, }; -void curses_display_init(DisplayState *ds, int full_screen) +void curses_display_init(DisplayState *ds, DisplayOptions *opts) { #ifndef _WIN32 if (!isatty(1)) { diff --git a/vl.c b/vl.c index 1d801dd96d..6fa65c0dbd 100644 --- a/vl.c +++ b/vl.c @@ -2189,6 +2189,7 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES display = DT_CURSES; + dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); exit(1); @@ -3275,6 +3276,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_curses: #ifdef CONFIG_CURSES display_type = DT_CURSES; + dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); exit(1); @@ -4708,7 +4710,7 @@ int main(int argc, char **argv, char **envp) /* init local displays */ switch (display_type) { case DT_CURSES: - curses_display_init(ds, full_screen); + curses_display_init(ds, &dpy); break; case DT_SDL: sdl_display_init(ds, &dpy); diff --git a/qapi/ui.json b/qapi/ui.json index cc489b7856..59597cfb3b 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk', 'sdl', 'egl-headless' ] } + 'data' : [ 'none', 'gtk', 'sdl', 'egl-headless', 'curses' ] } ## # @DisplayOptions: @@ -1041,4 +1041,5 @@ 'data' : { 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', - 'egl-headless' : 'DisplayNoOpts' } } + 'egl-headless' : 'DisplayNoOpts', + 'curses' : 'DisplayNoOpts' } } From patchwork Fri Feb 2 11:10:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0dR03znz9sRW for ; Sat, 3 Feb 2018 02:04:43 +1100 (AEDT) Received: from localhost ([::1]:35995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehctN-0001MT-3F for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:04:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcce-0003o7-DP for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehccd-0004xO-6o for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehccc-0004vv-To for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:47:23 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 107AC1362; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E4B18A5A; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1B1C54F279; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:19 +0100 Message-Id: <20180202111022.19269-10-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 02 Feb 2018 11:10:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 09/12] cocoa: use DisplayOptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch cocoa ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- include/ui/console.h | 4 ++-- vl.c | 3 ++- qapi/ui.json | 6 ++++-- ui/cocoa.m | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 9749503aa7..f96fd907d0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -454,9 +454,9 @@ static inline void sdl_display_init(DisplayState *ds, DisplayOptions *opts) /* cocoa.m */ #ifdef CONFIG_COCOA -void cocoa_display_init(DisplayState *ds, int full_screen); +void cocoa_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void cocoa_display_init(DisplayState *ds, int full_screen) +static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_COCOA is disabled */ error_report("Cocoa support is disabled"); diff --git a/vl.c b/vl.c index 6fa65c0dbd..eb8aca9479 100644 --- a/vl.c +++ b/vl.c @@ -4355,6 +4355,7 @@ int main(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) display_type = DT_COCOA; + dpy.type = DISPLAY_TYPE_COCOA; #elif defined(CONFIG_VNC) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else @@ -4716,7 +4717,7 @@ int main(int argc, char **argv, char **envp) sdl_display_init(ds, &dpy); break; case DT_COCOA: - cocoa_display_init(ds, full_screen); + cocoa_display_init(ds, &dpy); break; case DT_GTK: gtk_display_init(ds, &dpy); diff --git a/qapi/ui.json b/qapi/ui.json index 59597cfb3b..aca5402746 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,8 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk', 'sdl', 'egl-headless', 'curses' ] } + 'data' : [ 'none', 'gtk', 'sdl', + 'egl-headless', 'curses', 'cocoa' ] } ## # @DisplayOptions: @@ -1042,4 +1043,5 @@ 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', 'egl-headless' : 'DisplayNoOpts', - 'curses' : 'DisplayNoOpts' } } + 'curses' : 'DisplayNoOpts', + 'cocoa' : 'DisplayNoOpts' } } diff --git a/ui/cocoa.m b/ui/cocoa.m index 6be9848391..3e34d15716 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1682,12 +1682,12 @@ static void addRemovableDevicesMenuItems(void) qapi_free_BlockInfoList(pointerToFree); } -void cocoa_display_init(DisplayState *ds, int full_screen) +void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n"); /* if fullscreen mode is to be used */ - if (full_screen == true) { + if (opts->has_full_screen && opts->full_screen) { [NSApp activateIgnoringOtherApps: YES]; [(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil]; } From patchwork Fri Feb 2 11:10:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0rr4Ktsz9s4s for ; Sat, 3 Feb 2018 02:14:36 +1100 (AEDT) Received: from localhost ([::1]:36187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd2w-00016R-JE for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:14:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcek-0005VP-4c for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcee-0005xo-55 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35304) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehcee-0005xB-0B for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1659D641D9 for ; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7C3078E86; Fri, 2 Feb 2018 11:10:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 232E24F27A; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:20 +0100 Message-Id: <20180202111022.19269-11-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 02 Feb 2018 11:10:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 10/12] vl: drop full_screen variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Not used any more, delete it. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- vl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/vl.c b/vl.c index eb8aca9479..899fcad75e 100644 --- a/vl.c +++ b/vl.c @@ -149,7 +149,6 @@ static int rtc_utc = 1; static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; -static int full_screen = 0; static DisplayOptions dpy; int no_frame; Chardev *serial_hds[MAX_SERIAL_PORTS]; @@ -3659,7 +3658,6 @@ int main(int argc, char **argv, char **envp) loadvm = optarg; break; case QEMU_OPTION_full_screen: - full_screen = 1; dpy.has_full_screen = true; dpy.full_screen = true; break; From patchwork Fri Feb 2 11:10:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0m53JpHz9s4s for ; Sat, 3 Feb 2018 02:10:29 +1100 (AEDT) Received: from localhost ([::1]:36071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcyx-0005tk-FG for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:10:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcem-0005Vp-R8 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehceh-00060o-Tt for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehceh-00060A-Og for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A473796F2 for ; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 069B378E98; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2B46A4F27B; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:21 +0100 Message-Id: <20180202111022.19269-12-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Feb 2018 11:10:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 11/12] vl: drop request_opengl variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch over the one leftover user to qapi DisplayType. The delete the unused request_opengl variable. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- vl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/vl.c b/vl.c index 899fcad75e..4ef774e783 100644 --- a/vl.c +++ b/vl.c @@ -135,7 +135,6 @@ static const char *data_dir[16]; static int data_dir_idx; const char *bios_name = NULL; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; -int request_opengl = -1; int display_opengl; const char* keyboard_layout = NULL; ram_addr_t ram_size; @@ -2149,10 +2148,8 @@ static LegacyDisplayType select_display(const char *p) opts = nextopt; dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { - request_opengl = 1; dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { - request_opengl = 0; dpy.gl = false; } else { goto invalid_sdl_args; @@ -2177,7 +2174,6 @@ static LegacyDisplayType select_display(const char *p) } } else if (strstart(p, "egl-headless", &opts)) { #ifdef CONFIG_OPENGL_DMABUF - request_opengl = 1; display_opengl = 1; display = DT_EGL; dpy.type = DISPLAY_TYPE_EGL_HEADLESS; @@ -2214,10 +2210,8 @@ static LegacyDisplayType select_display(const char *p) opts = nextopt; dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { - request_opengl = 1; dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { - request_opengl = 0; dpy.gl = false; } else { goto invalid_gtk_args; @@ -4382,7 +4376,7 @@ int main(int argc, char **argv, char **envp) qemu_console_early_init(); - if (request_opengl == 1 && display_opengl == 0) { + if (dpy.has_gl && dpy.gl && display_opengl == 0) { #if defined(CONFIG_OPENGL) error_report("OpenGL is not supported by the display"); #else From patchwork Fri Feb 2 11:10:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 868622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zY0qq016Pz9s4s for ; Sat, 3 Feb 2018 02:13:42 +1100 (AEDT) Received: from localhost ([::1]:36173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehd23-0000Iy-9d for incoming@patchwork.ozlabs.org; Fri, 02 Feb 2018 10:13:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehcek-0005VR-7V for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehcee-0005xj-4M for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehced-0005x9-TN for qemu-devel@nongnu.org; Fri, 02 Feb 2018 09:49:28 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 151F4A0388 for ; Fri, 2 Feb 2018 11:10:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7355076603; Fri, 2 Feb 2018 11:10:27 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 347A54F29C; Fri, 2 Feb 2018 12:10:23 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 12:10:22 +0100 Message-Id: <20180202111022.19269-13-kraxel@redhat.com> In-Reply-To: <20180202111022.19269-1-kraxel@redhat.com> References: <20180202111022.19269-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 02 Feb 2018 11:10:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 12/12] vl: drop display_type variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch over all leftover users to qapi DisplayType. Then delete the unused display_type variable. Add 'default' DisplayType, which isn't an actual display type but a placeholder for "user didn't specify a display". It will be replaced by the DisplayType actually used, which in turn depends on the DisplayTypes availabel in the particular build. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake --- vl.c | 54 ++++++++++++++---------------------------------------- qapi/ui.json | 5 +++-- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/vl.c b/vl.c index 4ef774e783..42867d60f8 100644 --- a/vl.c +++ b/vl.c @@ -2079,24 +2079,12 @@ static void select_vgahw(const char *p) } } -typedef enum LegacyDisplayType { - DT_DEFAULT, - DT_CURSES, - DT_SDL, - DT_COCOA, - DT_GTK, - DT_EGL, - DT_NONE, -} LegacyDisplayType; - -static LegacyDisplayType select_display(const char *p) +static void parse_display(const char *p) { const char *opts; - LegacyDisplayType display = DT_DEFAULT; if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL - display = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2175,7 +2163,6 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "egl-headless", &opts)) { #ifdef CONFIG_OPENGL_DMABUF display_opengl = 1; - display = DT_EGL; dpy.type = DISPLAY_TYPE_EGL_HEADLESS; #else fprintf(stderr, "egl support is disabled\n"); @@ -2183,7 +2170,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES - display = DT_CURSES; dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -2191,7 +2177,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "gtk", &opts)) { #ifdef CONFIG_GTK - display = DT_GTK; dpy.type = DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; @@ -2228,14 +2213,11 @@ static LegacyDisplayType select_display(const char *p) exit(1); #endif } else if (strstart(p, "none", &opts)) { - display = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; } else { error_report("unknown display type"); exit(1); } - - return display; } static int balloon_parse(const char *arg) @@ -3063,7 +3045,6 @@ int main(int argc, char **argv, char **envp) const char *incoming = NULL; bool userconfig = true; bool nographic = false; - LegacyDisplayType display_type = DT_DEFAULT; int display_remote = 0; const char *log_mask = NULL; const char *log_file = NULL; @@ -3257,18 +3238,16 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_display: - display_type = select_display(optarg); + parse_display(optarg); break; case QEMU_OPTION_nographic: olist = qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "graphics=off", false); nographic = true; - display_type = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: #ifdef CONFIG_CURSES - display_type = DT_CURSES; dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -3676,7 +3655,6 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_sdl: #ifdef CONFIG_SDL - display_type = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; break; #else @@ -4292,7 +4270,7 @@ int main(int argc, char **argv, char **envp) exit(1); } #ifdef CONFIG_CURSES - if (display_type == DT_CURSES) { + if (dpy.type == DISPLAY_TYPE_CURSES) { error_report("curses display cannot be used with -daemonize"); exit(1); } @@ -4338,39 +4316,35 @@ int main(int argc, char **argv, char **envp) display_remote++; } #endif - if (display_type == DT_DEFAULT && !display_remote) { + if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) { #if defined(CONFIG_GTK) - display_type = DT_GTK; dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) - display_type = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) - display_type = DT_COCOA; dpy.type = DISPLAY_TYPE_COCOA; #elif defined(CONFIG_VNC) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else - display_type = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; #endif } - if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) { + if ((no_frame || alt_grab || ctrl_grab) && dpy.type != DISPLAY_TYPE_SDL) { error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); } if (dpy.has_window_close && - (display_type != DT_GTK && display_type != DT_SDL)) { + (dpy.type != DISPLAY_TYPE_GTK && dpy.type != DISPLAY_TYPE_SDL)) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); } - if (display_type == DT_GTK) { + if (dpy.type == DISPLAY_TYPE_GTK) { early_gtk_display_init(&dpy); } - if (display_type == DT_SDL) { + if (dpy.type == DISPLAY_TYPE_SDL) { sdl_display_early_init(&dpy); } @@ -4701,17 +4675,17 @@ int main(int argc, char **argv, char **envp) ds = init_displaystate(); /* init local displays */ - switch (display_type) { - case DT_CURSES: + switch (dpy.type) { + case DISPLAY_TYPE_CURSES: curses_display_init(ds, &dpy); break; - case DT_SDL: + case DISPLAY_TYPE_SDL: sdl_display_init(ds, &dpy); break; - case DT_COCOA: + case DISPLAY_TYPE_COCOA: cocoa_display_init(ds, &dpy); break; - case DT_GTK: + case DISPLAY_TYPE_GTK: gtk_display_init(ds, &dpy); break; default: @@ -4732,7 +4706,7 @@ int main(int argc, char **argv, char **envp) } #ifdef CONFIG_OPENGL_DMABUF - if (display_type == DT_EGL) { + if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) { egl_headless_init(&dpy); } #endif diff --git a/qapi/ui.json b/qapi/ui.json index aca5402746..08b89a01be 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1017,7 +1017,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'none', 'gtk', 'sdl', + 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless', 'curses', 'cocoa' ] } ## @@ -1039,7 +1039,8 @@ '*window-close' : 'bool', '*gl' : 'bool' }, 'discriminator' : 'type', - 'data' : { 'none' : 'DisplayNoOpts', + 'data' : { 'default' : 'DisplayNoOpts', + 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', 'egl-headless' : 'DisplayNoOpts',