aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-08-27 11:56:20 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-10-01 11:29:03 +0200
commite8b1386ea1719525a1a92df03377764703fe8c64 (patch)
tree15ab62a91ab3c244e23b90f511097af30b6a6bec /ui/gtk.c
parentb5dc0d7d565048fcf2767060261d8385805aced1 (diff)
downloadqemu-e8b1386ea1719525a1a92df03377764703fe8c64.zip
qemu-e8b1386ea1719525a1a92df03377764703fe8c64.tar.gz
qemu-e8b1386ea1719525a1a92df03377764703fe8c64.tar.bz2
gtk: add zoom-to-fit to gtk options.
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
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 5cce6ed..3ddb5fe 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;
}