diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod index 353b5fc..c25b70e 100644 --- a/man/remote-viewer.pod +++ b/man/remote-viewer.pod @@ -53,10 +53,17 @@ If supported, the remote display will be reconfigured to match the physical client monitor configuration, by enabling or disabling extra monitors as -necessary. This is currently implemented by the Spice backend only. +necessary. This is currently implemented by the Spice backend only and +can be disabled by the C<--auto-resize> arguemnt. To specify which client monitors are used in fullscreen mode, see the CONFIGURATION section below. + +=item -r , --auto-resize + +Controls whether it is permitted to attempt to resize the remote framebuffer +to match the local window size. This currently defaults to on, but note that +not all servers will support this. =item -t TITLE, --title TITLE diff --git a/man/virt-viewer.pod b/man/virt-viewer.pod index 9a88c92..f766c88 100644 --- a/man/virt-viewer.pod +++ b/man/virt-viewer.pod @@ -81,6 +81,12 @@ To specify which client monitors are used in fullscreen mode, see the CONFIGURATION section below. + +=item -r , --auto-resize + +Controls whether it is permitted to attempt to resize the remote framebuffer +to match the local window size. This currently defaults to on, but note that +not all servers will support this. =item -s, --shared diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index 560d1f5..359616f 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -2127,6 +2127,7 @@ static gboolean opt_kiosk = FALSE; static gboolean opt_kiosk_quit = FALSE; static gchar *opt_cursor = NULL; +static gchar *opt_resize = NULL; #ifndef G_OS_WIN32 static gboolean @@ -2559,6 +2560,24 @@ goto end; } virt_viewer_app_set_cursor(self, cursor); + } + + if (opt_resize) { + GAction *resize = g_action_map_lookup_action(G_ACTION_MAP(self), + "auto-resize"); + gboolean enabled = TRUE; + if (g_str_equal(opt_resize, "always")) { + enabled = TRUE; + } else if (g_str_equal(opt_resize, "never")) { + enabled = FALSE; + } else { + g_printerr("--auto-resize expects 'always' or 'never'\n"); + *status = 1; + ret = TRUE; + goto end; + } + g_simple_action_set_state(G_SIMPLE_ACTION(resize), + g_variant_new_boolean(enabled)); } end: @@ -3445,6 +3464,8 @@ N_("Open in full screen mode (adjusts guest resolution to fit the client)"), NULL }, { "hotkeys", 'H', 0, G_OPTION_ARG_STRING, &opt_hotkeys, N_("Customise hotkeys"), NULL }, + { "auto-resize", 'r', 0, G_OPTION_ARG_STRING, &opt_resize, + N_("Automatically resize remote framebuffer"), N_("") }, { "keymap", 'K', 0, G_OPTION_ARG_STRING, &opt_keymap, N_("Remap keys format key=keymod+key e.g. F1=SHIFT+CTRL+F1,1=SHIFT+F1,ALT_L=Void"), NULL }, { "cursor", '\0', 0, G_OPTION_ARG_STRING, &opt_cursor,