From 6595c9186463b68078d97692f2a9557a9174538a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 21 Feb 2012 10:15:11 -0800 Subject: [PATCH] Add arg and flag for swapping red and blue. --- protocols/vnc/include/client.h | 1 + protocols/vnc/src/client.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/protocols/vnc/include/client.h b/protocols/vnc/include/client.h index 101d4a01..62c60ee2 100644 --- a/protocols/vnc/include/client.h +++ b/protocols/vnc/include/client.h @@ -50,6 +50,7 @@ typedef struct vnc_guac_client_data { int copy_rect_used; char* password; char* encodings; + int swap_red_blue; guac_layer* cursor; diff --git a/protocols/vnc/src/client.c b/protocols/vnc/src/client.c index e49d1834..8d35e01e 100644 --- a/protocols/vnc/src/client.c +++ b/protocols/vnc/src/client.c @@ -55,6 +55,7 @@ const char* GUAC_CLIENT_ARGS[] = { "read-only", "encodings", "password", + "swap-red-blue", NULL }; @@ -66,7 +67,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { vnc_guac_client_data* guac_client_data; - int read_only = 0; + int read_only; /* Set up libvncclient logging */ rfbClientLog = guac_vnc_client_log_info; @@ -74,7 +75,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { /*** PARSE ARGUMENTS ***/ - if (argc < 5) { + if (argc < 6) { guac_protocol_send_error(client->socket, "Wrong argument count received."); guac_socket_flush(client->socket); return 1; @@ -84,9 +85,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_client_data = malloc(sizeof(vnc_guac_client_data)); client->data = guac_client_data; - /* If read-only specified, set flag */ - if (strcmp(argv[2], "true") == 0) - read_only = 1; + /* Set read-only flag */ + read_only = (strcmp(argv[2], "true") == 0); + + /* Set red/blue swap flag */ + guac_client_data->swap_red_blue = (strcmp(argv[5], "true") == 0); /* Freed after use by libvncclient */ guac_client_data->password = strdup(argv[4]);