Skip to content

Commit

Permalink
GUACAMOLE-1196: Add option to disable display resizing.
Browse files Browse the repository at this point in the history
  • Loading branch information
necouchman committed Jul 4, 2024
1 parent 667343a commit a608928
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/protocols/vnc/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/protocols/vnc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/vnc/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Expand Down
3 changes: 2 additions & 1 deletion src/protocols/vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a608928

Please sign in to comment.