From a608928ea60ba5f7a1cfa38aa8707ae138772a64 Mon Sep 17 00:00:00 2001 From: Virtually Nick Date: Thu, 4 Jul 2024 12:10:18 -0400 Subject: [PATCH] GUACAMOLE-1196: Add option to disable display resizing. --- src/protocols/vnc/settings.c | 13 +++++++++++++ src/protocols/vnc/settings.h | 6 ++++++ src/protocols/vnc/user.c | 2 +- src/protocols/vnc/vnc.c | 3 ++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c index 09ee8a7a..c7dda589 100644 --- a/src/protocols/vnc/settings.c +++ b/src/protocols/vnc/settings.c @@ -38,6 +38,7 @@ const char* GUAC_VNC_CLIENT_ARGS[] = { "hostname", "port", "read-only", + "disable-display-resize", "encodings", GUAC_VNC_ARGV_USERNAME, GUAC_VNC_ARGV_PASSWORD, @@ -119,6 +120,13 @@ enum VNC_ARGS_IDX { */ IDX_READ_ONLY, + /** + * "true" if the VNC client should disable attempts to resize the remote + * display to the client's size, "false" or blank if those resize messages + * should be sent. + */ + IDX_DISABLE_DISPLAY_RESIZE, + /** * Space-separated list of encodings to use within the VNC session. If not * specified, this will be: @@ -469,6 +477,11 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, IDX_DISABLE_SERVER_INPUT, false); + /* Disable display resize */ + settings->disable_display_resize = + guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, + IDX_DISABLE_DISPLAY_RESIZE, false); + /* Parse color depth */ settings->color_depth = guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv, diff --git a/src/protocols/vnc/settings.h b/src/protocols/vnc/settings.h index 3b885816..e5c3b779 100644 --- a/src/protocols/vnc/settings.h +++ b/src/protocols/vnc/settings.h @@ -54,6 +54,12 @@ typedef struct guac_vnc_settings { */ char* password; + /** + * Disable the VNC client messages to request that the remote (server) + * display resize to match the client resolution. + */ + bool disable_display_resize; + /** * Space-separated list of encodings to use within the VNC session. */ diff --git a/src/protocols/vnc/user.c b/src/protocols/vnc/user.c index 8134707f..4cb35176 100644 --- a/src/protocols/vnc/user.c +++ b/src/protocols/vnc/user.c @@ -92,7 +92,7 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) { #endif /* If user is owner, set size handler. */ - if (user->owner) + if (user->owner && !settings->disable_display_resize) user->size_handler = guac_vnc_user_size_handler; } diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index f2df4f4c..b1bd8608 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -510,7 +510,8 @@ void* guac_vnc_client_thread(void* data) { } /* Update the display with the owner's screen size. */ - guac_client_for_owner(client, guac_vnc_display_set_owner_size, rfb_client); + if (!settings->disable_display_resize) + guac_client_for_owner(client, guac_vnc_display_set_owner_size, rfb_client); guac_socket_flush(client->socket);