From 61ee76bf162caf14a9f8011f6797eaeb6716fae5 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 29 Apr 2012 23:12:58 -0700 Subject: [PATCH] Store clipboard data in client data. --- protocols/rdp/include/client.h | 2 ++ protocols/rdp/src/client.c | 1 + protocols/rdp/src/rdp_cliprdr.c | 10 +++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/protocols/rdp/include/client.h b/protocols/rdp/include/client.h index 306dbcec..f3e4dad0 100644 --- a/protocols/rdp/include/client.h +++ b/protocols/rdp/include/client.h @@ -82,6 +82,8 @@ typedef struct rdp_guac_client_data { guac_rdp_keysym_state_map keysym_state; + const char* clipboard; + } rdp_guac_client_data; typedef struct rdp_freerdp_context { diff --git a/protocols/rdp/src/client.c b/protocols/rdp/src/client.c index 87823add..930f55cb 100644 --- a/protocols/rdp/src/client.c +++ b/protocols/rdp/src/client.c @@ -367,6 +367,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_client_data->rdp_inst = rdp_inst; guac_client_data->mouse_button_mask = 0; guac_client_data->current_surface = GUAC_DEFAULT_LAYER; + guac_client_data->clipboard = ""; /* Clear keysym state mapping and keymap */ memset(guac_client_data->keysym_state, 0, diff --git a/protocols/rdp/src/rdp_cliprdr.c b/protocols/rdp/src/rdp_cliprdr.c index db57bf82..44318bbd 100644 --- a/protocols/rdp/src/rdp_cliprdr.c +++ b/protocols/rdp/src/rdp_cliprdr.c @@ -144,8 +144,16 @@ void guac_rdp_process_cb_data_response(guac_client* client, RDP_CB_DATA_RESPONSE_EVENT* event) { /* Received clipboard data */ - if (event->data[event->size - 1] == '\0') + if (event->data[event->size - 1] == '\0') { + + /* Store clipboard data */ + ((rdp_guac_client_data*) client->data)->clipboard = + strdup((char*) event->data); + + /* Send clipboard data */ guac_protocol_send_clipboard(client->socket, (char*) event->data); + + } else guac_client_log_error(client, "Clipboard data missing null terminator");