diff options
Diffstat (limited to 'plugins/rdp/rdp_cliprdr.c')
-rw-r--r-- | plugins/rdp/rdp_cliprdr.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/plugins/rdp/rdp_cliprdr.c b/plugins/rdp/rdp_cliprdr.c index a39e4f4c7..035d93a3f 100644 --- a/plugins/rdp/rdp_cliprdr.c +++ b/plugins/rdp/rdp_cliprdr.c @@ -45,6 +45,12 @@ #define CLIPBOARD_TRANSFER_WAIT_TIME 6 +#define CB_FORMAT_HTML 0xD010 +#define CB_FORMAT_PNG 0xD011 +#define CB_FORMAT_JPEG 0xD012 +#define CB_FORMAT_GIF 0xD013 +#define CB_FORMAT_TEXTURILIST 0xD014 + UINT32 remmina_rdp_cliprdr_get_format_from_gdkatom(GdkAtom atom) { TRACE_CALL(__func__); @@ -346,9 +352,15 @@ static UINT remmina_rdp_cliprdr_server_format_list(CliprdrClientContext *context REMMINA_PLUGIN_DEBUG("gp=%p: sending ClientFormatListResponse to server", gp); +#if FREERDP_VERSION_MAJOR >= 3 + formatListResponse.common.msgType = CB_FORMAT_LIST_RESPONSE; + formatListResponse.common.msgFlags = CB_RESPONSE_OK; // Can be CB_RESPONSE_FAIL in case of error + formatListResponse.common.dataLen = 0; +#else formatListResponse.msgType = CB_FORMAT_LIST_RESPONSE; formatListResponse.msgFlags = CB_RESPONSE_OK; // Can be CB_RESPONSE_FAIL in case of error formatListResponse.dataLen = 0; +#endif rc = clipboard->context->ClientFormatListResponse(clipboard->context, &formatListResponse); /* Schedule GTK event to tell GTK to change the local clipboard calling gtk_clipboard_set_with_owner * via REMMINA_RDP_UI_CLIPBOARD_SET_DATA @@ -442,7 +454,11 @@ static UINT remmina_rdp_cliprdr_server_format_data_response(CliprdrClientContext rfi = GET_PLUGIN_DATA(gp); data = formatDataResponse->requestedFormatData; +#if FREERDP_VERSION_MAJOR >= 3 + size = formatDataResponse->common.dataLen; +#else size = formatDataResponse->dataLen; +#endif REMMINA_PLUGIN_DEBUG("gp=%p server FormatDataResponse received: clipboard data arrived form server.", gp); gettimeofday(&now, NULL); @@ -457,8 +473,13 @@ static UINT remmina_rdp_cliprdr_server_format_data_response(CliprdrClientContext switch (rfi->clipboard.format) { case CF_UNICODETEXT: { - size = ConvertFromUnicode(CP_UTF8, 0, (WCHAR *)data, size / 2, (CHAR **)&output, 0, NULL, NULL); - crlf2lf(output, &size); + size = 0; + output = + g_utf16_to_utf8((const WCHAR *)data, size / sizeof(WCHAR), NULL, NULL, NULL); + if (output) { + size = strlen(output) + 1; + crlf2lf(output, &size); + } break; } @@ -764,8 +785,13 @@ CLIPRDR_FORMAT_LIST *remmina_rdp_cliprdr_get_client_format_list(RemminaProtocolW if (result) g_free(targets); +#if FREERDP_VERSION_MAJOR >= 3 + retp->pFormatList.common.msgType = CB_FORMAT_LIST; + retp->pFormatList.common.msgFlags = 0; +#else retp->pFormatList.msgType = CB_FORMAT_LIST; retp->pFormatList.msgFlags = 0; +#endif return (CLIPRDR_FORMAT_LIST *)retp; } @@ -821,9 +847,12 @@ void remmina_rdp_cliprdr_get_clipboard_data(RemminaProtocolWidget *gp, RemminaPl } case CF_UNICODETEXT: { - size = strlen((char *)inbuf); + size = strlen((const char *)inbuf); inbuf = lf2crlf(inbuf, &size); - size = (ConvertToUnicode(CP_UTF8, 0, (CHAR *)inbuf, -1, (WCHAR **)&outbuf, 0)) * sizeof(WCHAR); + outbuf = g_utf8_to_utf16((const char *)inbuf, size, NULL, NULL, NULL); + size = 0; + if (outbuf) + size = _wcslen((const char*)outbuf); g_free(inbuf); break; } |