From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <4seev3@gmail.com>) id 1aZF49-00005T-W0 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:52:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <4seev3@gmail.com>) id 1aZF46-0000j7-Pp for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:52:05 -0500 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:36322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <4seev3@gmail.com>) id 1aZF46-0000j1-E4 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:52:02 -0500 Received: by mail-lf0-x22b.google.com with SMTP id l83so2912136lfd.3 for ; Fri, 26 Feb 2016 01:52:01 -0800 (PST) Received: from [10.0.2.15] ([81.200.0.209]) by smtp.gmail.com with ESMTPSA id a14sm1736147lfe.7.2016.02.26.01.52.00 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Feb 2016 01:52:00 -0800 (PST) From: Igor S <4seev3@gmail.com> Message-ID: <56D0203F.5060303@gmail.com> Date: Fri, 26 Feb 2016 12:51:59 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] gtk: Add show_tabs=on|off command line option. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM. Signed-off-by: Igor Sudarikov <4seev3@gmail.com> --- include/ui/console.h | 2 +- qemu-options.hx | 2 +- ui/gtk.c | 5 ++++- vl.c | 12 +++++++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 6631b96..71132aa 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -453,6 +453,6 @@ int index_from_key(const char *key, size_t key_length); /* gtk.c */ void early_gtk_display_init(int opengl); -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover); +void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover, bool show_tabs); #endif diff --git a/qemu-options.hx b/qemu-options.hx index f528405..1c2e9ae 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -930,7 +930,7 @@ ETEXI DEF("display", HAS_ARG, QEMU_OPTION_display, "-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n" " [,window_close=on|off]|curses|none|\n" - " gtk[,grab_on_hover=on|off]|\n" + " gtk[,grab_on_hover=on|off][,show_tabs=on|off]|\n" " vnc=[,]\n" " select display type\n", QEMU_ARCH_ALL) STEXI diff --git a/ui/gtk.c b/ui/gtk.c index 3773826..8800eca 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2071,7 +2071,7 @@ static void gd_set_keycode_type(GtkDisplayState *s) static gboolean gtkinit; -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) +void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover, bool show_tabs) { GtkDisplayState *s = g_malloc0(sizeof(*s)); char *filename; @@ -2157,6 +2157,9 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) if (grab_on_hover) { gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item)); } + if (show_tabs) { + gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item)); + } gd_set_keycode_type(s); } diff --git a/vl.c b/vl.c index b87e292..e553611 100644 --- a/vl.c +++ b/vl.c @@ -146,6 +146,7 @@ static int no_frame = 0; int no_quit = 0; #ifdef CONFIG_GTK static bool grab_on_hover; +static bool show_tabs; #endif CharDriverState *serial_hds[MAX_SERIAL_PORTS]; CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; @@ -2194,6 +2195,15 @@ static DisplayType select_display(const char *p) } else { goto invalid_gtk_args; } + } else if (strstart(opts, ",show_tabs=", &nextopt)) { + opts = nextopt; + if (strstart(opts, "on", &nextopt)) { + show_tabs = true; + } else if (strstart(opts, "off", &nextopt)) { + show_tabs = false; + } else { + goto invalid_gtk_args; + } } else if (strstart(opts, ",gl=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { @@ -4567,7 +4577,7 @@ int main(int argc, char **argv, char **envp) #endif #if defined(CONFIG_GTK) case DT_GTK: - gtk_display_init(ds, full_screen, grab_on_hover); + gtk_display_init(ds, full_screen, grab_on_hover, show_tabs); break; #endif default: -- 2.7.0