mirror of https://github.com/FreeRDP/FreeRDP
[clien,mac] fix clipboard text copy
* copy format changed * copy length was off
This commit is contained in:
parent
6d9d118593
commit
a4f9702ad6
|
@ -326,9 +326,6 @@ static UINT
|
|||
mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
||||
const CLIPRDR_FORMAT_DATA_RESPONSE *formatDataResponse)
|
||||
{
|
||||
BYTE *data;
|
||||
UINT32 size;
|
||||
UINT32 index;
|
||||
UINT32 formatId;
|
||||
CLIPRDR_FORMAT *format = NULL;
|
||||
mfContext *mfc = (mfContext *)cliprdr->custom;
|
||||
|
@ -340,7 +337,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
|||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
for (index = 0; index < mfc->numServerFormats; index++)
|
||||
for (UINT32 index = 0; index < mfc->numServerFormats; index++)
|
||||
{
|
||||
if (mfc->requestedFormatId == mfc->serverFormats[index].formatId)
|
||||
format = &(mfc->serverFormats[index]);
|
||||
|
@ -357,7 +354,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
|||
else
|
||||
formatId = format->formatId;
|
||||
|
||||
size = formatDataResponse->common.dataLen;
|
||||
const size_t size = formatDataResponse->common.dataLen;
|
||||
|
||||
ClipboardSetData(mfc->clipboard, formatId, formatDataResponse->requestedFormatData, size);
|
||||
|
||||
|
@ -365,15 +362,15 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
|||
|
||||
if ((formatId == CF_TEXT) || (formatId == CF_OEMTEXT) || (formatId == CF_UNICODETEXT))
|
||||
{
|
||||
formatId = ClipboardRegisterFormat(mfc->clipboard, "UTF8_STRING");
|
||||
formatId = ClipboardRegisterFormat(mfc->clipboard, "text/plain");
|
||||
|
||||
data = (void *)ClipboardGetData(mfc->clipboard, formatId, &size);
|
||||
UINT32 dstSize = 0;
|
||||
const char *data = ClipboardGetData(mfc->clipboard, formatId, &dstSize);
|
||||
|
||||
if (size > 1)
|
||||
size--; /* we need the size without the null terminator */
|
||||
dstSize = strnlen(data, dstSize); /* we need the size without the null terminator */
|
||||
|
||||
NSString *str = [[NSString alloc] initWithBytes:(void *)data
|
||||
length:size
|
||||
length:dstSize
|
||||
encoding:NSUTF8StringEncoding];
|
||||
free(data);
|
||||
|
||||
|
|
|
@ -679,8 +679,6 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type)
|
|||
|
||||
- (void)onPasteboardTimerFired:(NSTimer *)timer
|
||||
{
|
||||
const void *data;
|
||||
UINT32 size;
|
||||
UINT32 formatId;
|
||||
BOOL formatMatch;
|
||||
int changeCount;
|
||||
|
@ -721,9 +719,9 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type)
|
|||
|
||||
formatString = [[NSString alloc] initWithData:formatData encoding:NSUTF8StringEncoding];
|
||||
|
||||
size = strlen([formatString UTF8String]) + 1;
|
||||
data = [formatString UTF8String];
|
||||
formatId = ClipboardRegisterFormat(mfc->clipboard, "UTF8_STRING");
|
||||
const char *data = [formatString UTF8String];
|
||||
const size_t size = strlen(data) + 1;
|
||||
formatId = ClipboardRegisterFormat(mfc->clipboard, "text/plain");
|
||||
ClipboardSetData(mfc->clipboard, formatId, data, size);
|
||||
[formatString release];
|
||||
|
||||
|
|
Loading…
Reference in New Issue