cliprdr/server: Provide the server with a possibility to configure capabilities

This commit is contained in:
Martin Fleisz 2015-10-27 17:12:33 +01:00
parent fa2c39f808
commit 730f43a380
3 changed files with 26 additions and 22 deletions

View File

@ -193,7 +193,7 @@ static UINT cliprdr_server_format_list(CliprdrServerContext* context, CLIPRDR_FO
CLIPRDR_FORMAT* format; CLIPRDR_FORMAT* format;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle; CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
if (!cliprdr->useLongFormatNames) if (!context->useLongFormatNames)
{ {
length = formatList->numFormats * 36; length = formatList->numFormats * 36;
@ -504,22 +504,21 @@ static UINT cliprdr_server_receive_general_capability(CliprdrServerContext* cont
{ {
UINT32 version; UINT32 version;
UINT32 generalFlags; UINT32 generalFlags;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
Stream_Read_UINT32(s, version); /* version (4 bytes) */ Stream_Read_UINT32(s, version); /* version (4 bytes) */
Stream_Read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */ Stream_Read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */
if (generalFlags & CB_USE_LONG_FORMAT_NAMES) if (context->useLongFormatNames)
cliprdr->useLongFormatNames = TRUE; context->useLongFormatNames = (generalFlags & CB_USE_LONG_FORMAT_NAMES) ? TRUE : FALSE;
if (generalFlags & CB_STREAM_FILECLIP_ENABLED) if (context->streamFileClipEnabled)
cliprdr->streamFileClipEnabled = TRUE; context->streamFileClipEnabled = (generalFlags & CB_STREAM_FILECLIP_ENABLED) ? TRUE : FALSE;
if (generalFlags & CB_FILECLIP_NO_FILE_PATHS) if (context->fileClipNoFilePaths)
cliprdr->fileClipNoFilePaths = TRUE; context->fileClipNoFilePaths = (generalFlags & CB_FILECLIP_NO_FILE_PATHS) ? TRUE : FALSE;
if (generalFlags & CB_CAN_LOCK_CLIPDATA) if (context->canLockClipData)
cliprdr->canLockClipData = TRUE; context->canLockClipData = (generalFlags & CB_CAN_LOCK_CLIPDATA) ? TRUE : FALSE;
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
@ -654,7 +653,7 @@ static UINT cliprdr_server_receive_format_list(CliprdrServerContext* context, wS
formatList.formats = NULL; formatList.formats = NULL;
formatList.numFormats = 0; formatList.numFormats = 0;
} }
else if (!cliprdr->useLongFormatNames) else if (!context->useLongFormatNames)
{ {
formatList.numFormats = (dataLen / 36); formatList.numFormats = (dataLen / 36);
@ -1103,9 +1102,18 @@ static UINT cliprdr_server_init(CliprdrServerContext* context)
generalFlags = 0; generalFlags = 0;
if (cliprdr->useLongFormatNames) if (context->useLongFormatNames)
generalFlags |= CB_USE_LONG_FORMAT_NAMES; generalFlags |= CB_USE_LONG_FORMAT_NAMES;
if (context->streamFileClipEnabled)
generalFlags |= CB_STREAM_FILECLIP_ENABLED;
if (context->fileClipNoFilePaths)
generalFlags |= CB_FILECLIP_NO_FILE_PATHS;
if (context->canLockClipData)
generalFlags |= CB_CAN_LOCK_CLIPDATA;
capabilities.msgType = CB_CLIP_CAPS; capabilities.msgType = CB_CLIP_CAPS;
capabilities.msgFlags = 0; capabilities.msgFlags = 0;
capabilities.dataLen = 4 + CB_CAPSTYPE_GENERAL_LEN; capabilities.dataLen = 4 + CB_CAPSTYPE_GENERAL_LEN;
@ -1527,11 +1535,6 @@ CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm)
{ {
cliprdr->vcm = vcm; cliprdr->vcm = vcm;
cliprdr->useLongFormatNames = TRUE;
cliprdr->streamFileClipEnabled = TRUE;
cliprdr->fileClipNoFilePaths = TRUE;
cliprdr->canLockClipData = TRUE;
cliprdr->s = Stream_New(NULL, 4096); cliprdr->s = Stream_New(NULL, 4096);
if(!cliprdr->s) if(!cliprdr->s)

View File

@ -40,11 +40,6 @@ struct _cliprdr_server_private
void* ChannelHandle; void* ChannelHandle;
HANDLE ChannelEvent; HANDLE ChannelEvent;
BOOL useLongFormatNames;
BOOL streamFileClipEnabled;
BOOL fileClipNoFilePaths;
BOOL canLockClipData;
wStream* s; wStream* s;
char* temporaryDirectory; char* temporaryDirectory;
}; };

View File

@ -68,6 +68,12 @@ struct _cliprdr_server_context
void* handle; void* handle;
void* custom; void* custom;
/* clipboard capabilities - set by server */
BOOL useLongFormatNames;
BOOL streamFileClipEnabled;
BOOL fileClipNoFilePaths;
BOOL canLockClipData;
psCliprdrOpen Open; psCliprdrOpen Open;
psCliprdrClose Close; psCliprdrClose Close;
psCliprdrStart Start; psCliprdrStart Start;