* [Qemu-devel] [PATCH] gtk: add zoom-to-fit to gtk options.
@ 2018-08-24 5:51 Gerd Hoffmann
2018-08-24 8:18 ` Markus Armbruster
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2018-08-24 5:51 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Gerd Hoffmann, Markus Armbruster
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 <kraxel@redhat.com>
---
ui/gtk.c | 8 ++++++++
qapi/ui.json | 3 ++-
2 files changed, 10 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..bf2d0fa60e 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1027,7 +1027,8 @@
#
##
{ 'struct' : 'DisplayGTK',
- 'data' : { '*grab-on-hover' : 'bool' } }
+ 'data' : { '*grab-on-hover' : 'bool',
+ '*zoom-to-fit' : 'bool' } }
##
# @DisplayGLMode:
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] gtk: add zoom-to-fit to gtk options.
2018-08-24 5:51 [Qemu-devel] [PATCH] gtk: add zoom-to-fit to gtk options Gerd Hoffmann
@ 2018-08-24 8:18 ` Markus Armbruster
0 siblings, 0 replies; 2+ messages in thread
From: Markus Armbruster @ 2018-08-24 8:18 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Gerd Hoffmann <kraxel@redhat.com> writes:
> 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 <kraxel@redhat.com>
> ---
> ui/gtk.c | 8 ++++++++
> qapi/ui.json | 3 ++-
> 2 files changed, 10 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..bf2d0fa60e 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -1027,7 +1027,8 @@
##
# @DisplayGTK:
#
# GTK display options.
#
# @grab-on-hover: Grab keyboard input on mouse hover.
Missing:
+ # @zoom-to-fit: bla, bla (Since 3.1)
#
# Since: 2.12
> #
> ##
> { 'struct' : 'DisplayGTK',
> - 'data' : { '*grab-on-hover' : 'bool' } }
> + 'data' : { '*grab-on-hover' : 'bool',
> + '*zoom-to-fit' : 'bool' } }
>
> ##
> # @DisplayGLMode:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-24 8:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-24 5:51 [Qemu-devel] [PATCH] gtk: add zoom-to-fit to gtk options Gerd Hoffmann
2018-08-24 8:18 ` Markus Armbruster
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).