From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eric Blake <eblake@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PULL 3/3] gtk: add zoom-to-fit to gtk options.
Date: Mon, 1 Oct 2018 12:42:30 +0200 [thread overview]
Message-ID: <20181001104230.17779-4-kraxel@redhat.com> (raw)
In-Reply-To: <20181001104230.17779-1-kraxel@redhat.com>
This allows to set the option on the command line, i.e. "-display
gtk,zoom-to-fit={on,off}", overriding the default chosen by qemu.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20180827095620.26774-1-kraxel@redhat.com
---
ui/gtk.c | 8 ++++++++
qapi/ui.json | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 5cce6ed42d..3ddb5fe162 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2136,6 +2136,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
QemuConsole *con, int idx,
GSList *group, GtkWidget *view_menu)
{
+ bool zoom_to_fit;
+
vc->label = qemu_console_get_label(con);
vc->s = s;
vc->gfx.scale_x = 1.0;
@@ -2199,6 +2201,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
group = gd_vc_menu_init(s, vc, idx, group, view_menu);
if (dpy_ui_info_supported(vc->gfx.dcl.con)) {
+ zoom_to_fit = true;
+ }
+ if (s->opts->u.gtk.has_zoom_to_fit) {
+ zoom_to_fit = s->opts->u.gtk.zoom_to_fit;
+ }
+ if (zoom_to_fit) {
gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_fit_item));
s->free_scale = true;
}
diff --git a/qapi/ui.json b/qapi/ui.json
index 4ca91bb45a..bf9e157d5a 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1022,12 +1022,20 @@
# GTK display options.
#
# @grab-on-hover: Grab keyboard input on mouse hover.
+# @zoom-to-fit: Zoom guest display to fit into the host window. When
+# turned off the host window will be resized instead.
+# In case the display device can notify the guest on
+# window resizes (virtio-gpu) this will default to "on",
+# assuming the guest will resize the display to match
+# the window size then. Otherwise it defaults to "off".
+# Since 3.1
#
# Since: 2.12
#
##
{ 'struct' : 'DisplayGTK',
- 'data' : { '*grab-on-hover' : 'bool' } }
+ 'data' : { '*grab-on-hover' : 'bool',
+ '*zoom-to-fit' : 'bool' } }
##
# @DisplayGLMode:
--
2.9.3
next prev parent reply other threads:[~2018-10-01 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 10:42 [Qemu-devel] [PULL 0/3] Ui 20181001 patches Gerd Hoffmann
2018-10-01 10:42 ` [Qemu-devel] [PULL 1/3] sdl2: show console #0 unconditionally Gerd Hoffmann
2018-10-01 10:42 ` [Qemu-devel] [PULL 2/3] vnc: call sasl_server_init() only when required Gerd Hoffmann
2018-10-01 10:42 ` Gerd Hoffmann [this message]
2018-10-01 15:36 ` [Qemu-devel] [PULL 0/3] Ui 20181001 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181001104230.17779-4-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).