Codebase list virt-viewer / e9e2ebb
src: add --auto-resize <always|never> CLI arg This is used to control whether resizing of the remote framebuffer is permitted. Fixes: https://gitlab.com/virt-viewer/virt-viewer/-/issues/20 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Daniel P. Berrangé 3 years ago
3 changed file(s) with 35 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5252
5353 If supported, the remote display will be reconfigured to match the physical
5454 client monitor configuration, by enabling or disabling extra monitors as
55 necessary. This is currently implemented by the Spice backend only.
55 necessary. This is currently implemented by the Spice backend only and
56 can be disabled by the C<--auto-resize> arguemnt.
5657
5758 To specify which client monitors are used in fullscreen mode, see the
5859 CONFIGURATION section below.
60
61 =item -r <always|never>, --auto-resize <always|never>
62
63 Controls whether it is permitted to attempt to resize the remote framebuffer
64 to match the local window size. This currently defaults to on, but note that
65 not all servers will support this.
5966
6067 =item -t TITLE, --title TITLE
6168
8080
8181 To specify which client monitors are used in fullscreen mode, see the
8282 CONFIGURATION section below.
83
84 =item -r <always|never>, --auto-resize <always|never>
85
86 Controls whether it is permitted to attempt to resize the remote framebuffer
87 to match the local window size. This currently defaults to on, but note that
88 not all servers will support this.
8389
8490 =item -s, --shared
8591
21262126 static gboolean opt_kiosk = FALSE;
21272127 static gboolean opt_kiosk_quit = FALSE;
21282128 static gchar *opt_cursor = NULL;
2129 static gchar *opt_resize = NULL;
21292130
21302131 #ifndef G_OS_WIN32
21312132 static gboolean
25582559 goto end;
25592560 }
25602561 virt_viewer_app_set_cursor(self, cursor);
2562 }
2563
2564 if (opt_resize) {
2565 GAction *resize = g_action_map_lookup_action(G_ACTION_MAP(self),
2566 "auto-resize");
2567 gboolean enabled = TRUE;
2568 if (g_str_equal(opt_resize, "always")) {
2569 enabled = TRUE;
2570 } else if (g_str_equal(opt_resize, "never")) {
2571 enabled = FALSE;
2572 } else {
2573 g_printerr("--auto-resize expects 'always' or 'never'\n");
2574 *status = 1;
2575 ret = TRUE;
2576 goto end;
2577 }
2578 g_simple_action_set_state(G_SIMPLE_ACTION(resize),
2579 g_variant_new_boolean(enabled));
25612580 }
25622581
25632582 end:
34443463 N_("Open in full screen mode (adjusts guest resolution to fit the client)"), NULL },
34453464 { "hotkeys", 'H', 0, G_OPTION_ARG_STRING, &opt_hotkeys,
34463465 N_("Customise hotkeys"), NULL },
3466 { "auto-resize", 'r', 0, G_OPTION_ARG_STRING, &opt_resize,
3467 N_("Automatically resize remote framebuffer"), N_("<never|always>") },
34473468 { "keymap", 'K', 0, G_OPTION_ARG_STRING, &opt_keymap,
34483469 N_("Remap keys format key=keymod+key e.g. F1=SHIFT+CTRL+F1,1=SHIFT+F1,ALT_L=Void"), NULL },
34493470 { "cursor", '\0', 0, G_OPTION_ARG_STRING, &opt_cursor,