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,
|
mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
||||||
const CLIPRDR_FORMAT_DATA_RESPONSE *formatDataResponse)
|
const CLIPRDR_FORMAT_DATA_RESPONSE *formatDataResponse)
|
||||||
{
|
{
|
||||||
BYTE *data;
|
|
||||||
UINT32 size;
|
|
||||||
UINT32 index;
|
|
||||||
UINT32 formatId;
|
UINT32 formatId;
|
||||||
CLIPRDR_FORMAT *format = NULL;
|
CLIPRDR_FORMAT *format = NULL;
|
||||||
mfContext *mfc = (mfContext *)cliprdr->custom;
|
mfContext *mfc = (mfContext *)cliprdr->custom;
|
||||||
|
@ -340,7 +337,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
||||||
return ERROR_INTERNAL_ERROR;
|
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)
|
if (mfc->requestedFormatId == mfc->serverFormats[index].formatId)
|
||||||
format = &(mfc->serverFormats[index]);
|
format = &(mfc->serverFormats[index]);
|
||||||
|
@ -357,7 +354,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
|
||||||
else
|
else
|
||||||
formatId = format->formatId;
|
formatId = format->formatId;
|
||||||
|
|
||||||
size = formatDataResponse->common.dataLen;
|
const size_t size = formatDataResponse->common.dataLen;
|
||||||
|
|
||||||
ClipboardSetData(mfc->clipboard, formatId, formatDataResponse->requestedFormatData, size);
|
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))
|
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)
|
dstSize = strnlen(data, dstSize); /* we need the size without the null terminator */
|
||||||
size--; /* we need the size without the null terminator */
|
|
||||||
|
|
||||||
NSString *str = [[NSString alloc] initWithBytes:(void *)data
|
NSString *str = [[NSString alloc] initWithBytes:(void *)data
|
||||||
length:size
|
length:dstSize
|
||||||
encoding:NSUTF8StringEncoding];
|
encoding:NSUTF8StringEncoding];
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
|
|
|
@ -679,8 +679,6 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type)
|
||||||
|
|
||||||
- (void)onPasteboardTimerFired:(NSTimer *)timer
|
- (void)onPasteboardTimerFired:(NSTimer *)timer
|
||||||
{
|
{
|
||||||
const void *data;
|
|
||||||
UINT32 size;
|
|
||||||
UINT32 formatId;
|
UINT32 formatId;
|
||||||
BOOL formatMatch;
|
BOOL formatMatch;
|
||||||
int changeCount;
|
int changeCount;
|
||||||
|
@ -721,9 +719,9 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type)
|
||||||
|
|
||||||
formatString = [[NSString alloc] initWithData:formatData encoding:NSUTF8StringEncoding];
|
formatString = [[NSString alloc] initWithData:formatData encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
size = strlen([formatString UTF8String]) + 1;
|
const char *data = [formatString UTF8String];
|
||||||
data = [formatString UTF8String];
|
const size_t size = strlen(data) + 1;
|
||||||
formatId = ClipboardRegisterFormat(mfc->clipboard, "UTF8_STRING");
|
formatId = ClipboardRegisterFormat(mfc->clipboard, "text/plain");
|
||||||
ClipboardSetData(mfc->clipboard, formatId, data, size);
|
ClipboardSetData(mfc->clipboard, formatId, data, size);
|
||||||
[formatString release];
|
[formatString release];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue