diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c index 691e7083..a476b2c1 100644 --- a/src/protocols/vnc/settings.c +++ b/src/protocols/vnc/settings.c @@ -91,6 +91,8 @@ const char* GUAC_VNC_CLIENT_ARGS[] = { "wol-broadcast-addr", "wol-udp-port", "wol-wait-time", + + "force-lossless", NULL }; @@ -373,6 +375,12 @@ enum VNC_ARGS_IDX { */ IDX_WOL_WAIT_TIME, + /** + * "true" if all graphical updates for this connection should use lossless + * compresion only, "false" or blank otherwise. + */ + IDX_FORCE_LOSSLESS, + VNC_ARGS_COUNT }; @@ -432,6 +440,11 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user, guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv, IDX_COLOR_DEPTH, 0); + /* Lossless compression */ + settings->lossless = + guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, + IDX_FORCE_LOSSLESS, false); + #ifdef ENABLE_VNC_REPEATER /* Set repeater parameters if specified */ settings->dest_host = diff --git a/src/protocols/vnc/settings.h b/src/protocols/vnc/settings.h index 6d1c6575..76139bd4 100644 --- a/src/protocols/vnc/settings.h +++ b/src/protocols/vnc/settings.h @@ -77,6 +77,12 @@ typedef struct guac_vnc_settings { */ bool read_only; + /** + * Whether all graphical updates for this connection should use lossless + * compression only. + */ + bool lossless; + #ifdef ENABLE_VNC_REPEATER /** * The VNC host to connect to, if using a repeater. diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index ade8278b..4dcf861d 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -435,6 +435,10 @@ void* guac_vnc_client_thread(void* data) { vnc_client->display = guac_common_display_alloc(client, rfb_client->width, rfb_client->height); + /* Use lossless compression only if requested (otherwise, use default + * heuristics) */ + guac_common_display_set_lossless(vnc_client->display, settings->lossless); + /* If not read-only, set an appropriate cursor */ if (settings->read_only == 0) { if (settings->remote_cursor)