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
This commit is contained in:
parent
b5dc0d7d56
commit
e8b1386ea1
10
qapi/ui.json
10
qapi/ui.json
|
@ -1022,12 +1022,20 @@
|
||||||
# GTK display options.
|
# GTK display options.
|
||||||
#
|
#
|
||||||
# @grab-on-hover: Grab keyboard input on mouse hover.
|
# @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
|
# Since: 2.12
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
{ 'struct' : 'DisplayGTK',
|
{ 'struct' : 'DisplayGTK',
|
||||||
'data' : { '*grab-on-hover' : 'bool' } }
|
'data' : { '*grab-on-hover' : 'bool',
|
||||||
|
'*zoom-to-fit' : 'bool' } }
|
||||||
|
|
||||||
##
|
##
|
||||||
# @DisplayGLMode:
|
# @DisplayGLMode:
|
||||||
|
|
8
ui/gtk.c
8
ui/gtk.c
|
@ -2136,6 +2136,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
QemuConsole *con, int idx,
|
QemuConsole *con, int idx,
|
||||||
GSList *group, GtkWidget *view_menu)
|
GSList *group, GtkWidget *view_menu)
|
||||||
{
|
{
|
||||||
|
bool zoom_to_fit;
|
||||||
|
|
||||||
vc->label = qemu_console_get_label(con);
|
vc->label = qemu_console_get_label(con);
|
||||||
vc->s = s;
|
vc->s = s;
|
||||||
vc->gfx.scale_x = 1.0;
|
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);
|
group = gd_vc_menu_init(s, vc, idx, group, view_menu);
|
||||||
|
|
||||||
if (dpy_ui_info_supported(vc->gfx.dcl.con)) {
|
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));
|
gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_fit_item));
|
||||||
s->free_scale = true;
|
s->free_scale = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue