gtk: add zoom-to-fit to gtk options.
PATCH v2 1/1 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 choosen by qemu.
Signed-off-by Gerd Hoffmann <[email protected]>
--- ui/gtk.c | 8 ++++++++ qapi/ui.json | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
ui/gtk.c +8 -0
@@ -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; }
qapi/ui.json +5 -1
@@ -1022,12 +1022,16 @@ # 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 +# (since 3.1). # # Since: 2.12 # ## { 'struct' : 'DisplayGTK', - 'data' : { '*grab-on-hover' : 'bool' } } + 'data' : { '*grab-on-hover' : 'bool', + '*zoom-to-fit' : 'bool' } } ## # @DisplayGLMode:
Signature · 1 line
2.9.3
Quoted 2 lines · Gerd Hoffmann
This allows to set the option on the command line, i.e. "-display gtk,zoom-to-fit={on,off}", overriding the default choosen by qemu.
chosen
Quoted 38 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- ui/gtk.c | 8 ++++++++ qapi/ui.json | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)ui/gtk.c +8
-0@@ -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; }qapi/ui.json +0
-0
qapi/ui.json line 1027
Quoted 6 lines
qapi/ui.json +3
-0@@ -1022,12 +1022,16 @@ # 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 +# (since 3.1).
What's the default?
The cover letter says its chosen by QEMU. Matches my reading of the patch. Please document it.
qapi/ui.json line 1037
Quoted 11 lines
qapi/ui.json +2
-1# # Since: 2.12 # ## { 'struct' : 'DisplayGTK', - 'data' : { '*grab-on-hover' : 'bool' } } + 'data' : { '*grab-on-hover' : 'bool', + '*zoom-to-fit' : 'bool' } } ## # @DisplayGLMode:
With a suitable doc fix
Reviewed-by Markus Armbruster <[email protected]>