From a8f763f2a7f5c35122a31638109083fc7fdf0de4 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. --- include/client.h | 2 ++ src/client.c | 1 + src/rdp_cliprdr.c | 10 +++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/client.h b/include/client.h index 306dbce..f3e4dad 100644 --- a/include/client.h +++ b/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/src/client.c b/src/client.c index 87823ad..930f55c 100644 --- a/src/client.c +++ b/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/src/rdp_cliprdr.c b/src/rdp_cliprdr.c index db57bf8..44318bb 100644 --- a/src/rdp_cliprdr.c +++ b/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"); -- 1.7.10.4