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
52 | 52 | |
53 | 53 | If supported, the remote display will be reconfigured to match the physical |
54 | 54 | 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. | |
56 | 57 | |
57 | 58 | To specify which client monitors are used in fullscreen mode, see the |
58 | 59 | 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. | |
59 | 66 | |
60 | 67 | =item -t TITLE, --title TITLE |
61 | 68 |
80 | 80 | |
81 | 81 | To specify which client monitors are used in fullscreen mode, see the |
82 | 82 | 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. | |
83 | 89 | |
84 | 90 | =item -s, --shared |
85 | 91 |
2126 | 2126 | static gboolean opt_kiosk = FALSE; |
2127 | 2127 | static gboolean opt_kiosk_quit = FALSE; |
2128 | 2128 | static gchar *opt_cursor = NULL; |
2129 | static gchar *opt_resize = NULL; | |
2129 | 2130 | |
2130 | 2131 | #ifndef G_OS_WIN32 |
2131 | 2132 | static gboolean |
2558 | 2559 | goto end; |
2559 | 2560 | } |
2560 | 2561 | 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)); | |
2561 | 2580 | } |
2562 | 2581 | |
2563 | 2582 | end: |
3444 | 3463 | N_("Open in full screen mode (adjusts guest resolution to fit the client)"), NULL }, |
3445 | 3464 | { "hotkeys", 'H', 0, G_OPTION_ARG_STRING, &opt_hotkeys, |
3446 | 3465 | N_("Customise hotkeys"), NULL }, |
3466 | { "auto-resize", 'r', 0, G_OPTION_ARG_STRING, &opt_resize, | |
3467 | N_("Automatically resize remote framebuffer"), N_("<never|always>") }, | |
3447 | 3468 | { "keymap", 'K', 0, G_OPTION_ARG_STRING, &opt_keymap, |
3448 | 3469 | N_("Remap keys format key=keymod+key e.g. F1=SHIFT+CTRL+F1,1=SHIFT+F1,ALT_L=Void"), NULL }, |
3449 | 3470 | { "cursor", '\0', 0, G_OPTION_ARG_STRING, &opt_cursor, |