freerdp: unify clipboard standard format id definitions
This commit is contained in:
parent
334dec3c1f
commit
a1e660d92e
@ -318,9 +318,9 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case CB_FORMAT_TEXT:
|
||||
case CB_FORMAT_DIB:
|
||||
case CB_FORMAT_UNICODETEXT:
|
||||
case CF_TEXT:
|
||||
case CF_DIB:
|
||||
case CF_UNICODETEXT:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -141,8 +141,8 @@ void android_cliprdr_init(freerdp* inst)
|
||||
cb->channels = inst->context->channels;
|
||||
|
||||
cb->android_formats = (UINT32*)malloc(sizeof(UINT32) * 3);
|
||||
cb->android_formats[0] = CB_FORMAT_TEXT;
|
||||
cb->android_formats[1] = CB_FORMAT_UNICODETEXT;
|
||||
cb->android_formats[0] = CF_TEXT;
|
||||
cb->android_formats[1] = CF_UNICODETEXT;
|
||||
cb->android_formats[2] = CB_FORMAT_HTML;
|
||||
cb->android_num_formats = 3;
|
||||
|
||||
@ -381,21 +381,18 @@ static void android_cliprdr_process_cb_data_request_event(clipboardContext* cb,
|
||||
|
||||
switch (event->format)
|
||||
{
|
||||
case CB_FORMAT_RAW:
|
||||
case CB_FORMAT_PNG:
|
||||
case CB_FORMAT_JPEG:
|
||||
case CB_FORMAT_GIF:
|
||||
case CB_FORMAT_DIB:
|
||||
case 0:
|
||||
case CF_DIB:
|
||||
default:
|
||||
DEBUG_ANDROID("unsupported format %x\n", event->format);
|
||||
outbuf = NULL;
|
||||
break;
|
||||
|
||||
case CB_FORMAT_UNICODETEXT:
|
||||
case CF_UNICODETEXT:
|
||||
outbuf = android_cliprdr_process_requested_unicodetext(cb->android_data, &size);
|
||||
break;
|
||||
|
||||
case CB_FORMAT_TEXT:
|
||||
case CF_TEXT:
|
||||
outbuf = android_cliprdr_process_requested_text(cb->android_data, &size);
|
||||
break;
|
||||
|
||||
@ -436,21 +433,21 @@ static void android_cliprdr_process_cb_format_list_event(clipboardContext* cb, R
|
||||
if (cb->formats)
|
||||
free(cb->formats);
|
||||
|
||||
cb->data_format = CB_FORMAT_RAW;
|
||||
cb->data_format = 0;
|
||||
cb->formats = event->formats;
|
||||
cb->num_formats = event->num_formats;
|
||||
event->formats = NULL;
|
||||
event->num_formats = 0;
|
||||
|
||||
if (android_cliprdr_has_format(cb->formats, cb->num_formats, CB_FORMAT_TEXT))
|
||||
if (android_cliprdr_has_format(cb->formats, cb->num_formats, CF_TEXT))
|
||||
{
|
||||
cb->data_format = CB_FORMAT_TEXT;
|
||||
android_cliprdr_send_data_request(cb, CB_FORMAT_TEXT);
|
||||
cb->data_format = CF_TEXT;
|
||||
android_cliprdr_send_data_request(cb, CF_TEXT);
|
||||
}
|
||||
else if (android_cliprdr_has_format(cb->formats, cb->num_formats, CB_FORMAT_UNICODETEXT))
|
||||
else if (android_cliprdr_has_format(cb->formats, cb->num_formats, CF_UNICODETEXT))
|
||||
{
|
||||
cb->data_format = CB_FORMAT_UNICODETEXT;
|
||||
android_cliprdr_send_data_request(cb, CB_FORMAT_UNICODETEXT);
|
||||
cb->data_format = CF_UNICODETEXT;
|
||||
android_cliprdr_send_data_request(cb, CF_UNICODETEXT);
|
||||
}
|
||||
else if (android_cliprdr_has_format(cb->formats, cb->num_formats, CB_FORMAT_HTML))
|
||||
{
|
||||
@ -518,20 +515,17 @@ static void android_cliprdr_process_cb_data_response_event(clipboardContext* cb,
|
||||
}
|
||||
switch (cb->data_format)
|
||||
{
|
||||
case CB_FORMAT_RAW:
|
||||
case CB_FORMAT_PNG:
|
||||
case CB_FORMAT_JPEG:
|
||||
case CB_FORMAT_GIF:
|
||||
case CB_FORMAT_DIB:
|
||||
case 0:
|
||||
case CF_DIB:
|
||||
default:
|
||||
DEBUG_ANDROID("unsupported format\n");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_TEXT:
|
||||
case CF_TEXT:
|
||||
android_cliprdr_process_text(cb, event->data, event->size - 1);
|
||||
break;
|
||||
|
||||
case CB_FORMAT_UNICODETEXT:
|
||||
case CF_UNICODETEXT:
|
||||
android_cliprdr_process_unicodetext(cb, event->data, event->size - 2);
|
||||
break;
|
||||
|
||||
|
@ -1353,8 +1353,8 @@ void cliprdr_send_data_request(freerdp* instance, UINT32 format)
|
||||
|
||||
/**
|
||||
* at the moment, only the following formats are supported
|
||||
* CB_FORMAT_TEXT
|
||||
* CB_FORMAT_UNICODETEXT
|
||||
* CF_TEXT
|
||||
* CF_UNICODETEXT
|
||||
*/
|
||||
|
||||
void cliprdr_process_cb_data_response_event(freerdp* instance, RDP_CB_DATA_RESPONSE_EVENT* event)
|
||||
@ -1367,7 +1367,7 @@ void cliprdr_process_cb_data_response_event(freerdp* instance, RDP_CB_DATA_RESPO
|
||||
if (event->size == 0)
|
||||
return;
|
||||
|
||||
if (view->pasteboard_format == CB_FORMAT_TEXT || view->pasteboard_format == CB_FORMAT_UNICODETEXT)
|
||||
if (view->pasteboard_format == CF_TEXT || view->pasteboard_format == CF_UNICODETEXT)
|
||||
{
|
||||
str = [[NSString alloc] initWithCharacters:(unichar *) event->data length:event->size / 2];
|
||||
types = [[NSArray alloc] initWithObjects:NSStringPboardType, nil];
|
||||
@ -1391,8 +1391,8 @@ void cliprdr_process_cb_monitor_ready_event(freerdp* instance)
|
||||
|
||||
/**
|
||||
* list of supported clipboard formats; currently only the following are supported
|
||||
* CB_FORMAT_TEXT
|
||||
* CB_FORMAT_UNICODETEXT
|
||||
* CF_TEXT
|
||||
* CF_UNICODETEXT
|
||||
*/
|
||||
|
||||
void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_EVENT* event)
|
||||
@ -1408,36 +1408,12 @@ void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_
|
||||
{
|
||||
switch (event->formats[i])
|
||||
{
|
||||
case CB_FORMAT_RAW:
|
||||
WLog_ERR(TAG, "CB_FORMAT_RAW: not yet supported");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_TEXT:
|
||||
case CB_FORMAT_UNICODETEXT:
|
||||
view->pasteboard_format = CB_FORMAT_UNICODETEXT;
|
||||
cliprdr_send_data_request(instance, CB_FORMAT_UNICODETEXT);
|
||||
case CF_TEXT:
|
||||
case CF_UNICODETEXT:
|
||||
view->pasteboard_format = CF_UNICODETEXT;
|
||||
cliprdr_send_data_request(instance, CF_UNICODETEXT);
|
||||
return;
|
||||
break;
|
||||
|
||||
case CB_FORMAT_DIB:
|
||||
WLog_ERR(TAG, "CB_FORMAT_DIB: not yet supported");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_HTML:
|
||||
WLog_ERR(TAG, "CB_FORMAT_HTML");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_PNG:
|
||||
WLog_ERR(TAG, "CB_FORMAT_PNG: not yet supported");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_JPEG:
|
||||
WLog_ERR(TAG, "CB_FORMAT_JPEG: not yet supported");
|
||||
break;
|
||||
|
||||
case CB_FORMAT_GIF:
|
||||
WLog_ERR(TAG, "CB_FORMAT_GIF: not yet supported");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1501,7 +1477,7 @@ void cliprdr_send_supported_format_list(freerdp* instance)
|
||||
|
||||
event->formats = (UINT32*) malloc(sizeof(UINT32) * 1);
|
||||
event->num_formats = 1;
|
||||
event->formats[0] = CB_FORMAT_UNICODETEXT;
|
||||
event->formats[0] = CF_UNICODETEXT;
|
||||
|
||||
freerdp_channels_send_event(instance->context->channels, (wMessage*) event);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ static xfCliprdrFormat* xf_cliprdr_get_format_by_atom(xfClipboard* clipboard, At
|
||||
if (format->atom != atom)
|
||||
continue;
|
||||
|
||||
if (format->formatId == CLIPRDR_FORMAT_RAW)
|
||||
if (format->formatId == 0)
|
||||
return format;
|
||||
|
||||
for (j = 0; j < clipboard->numServerFormats; j++)
|
||||
@ -505,22 +505,22 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL has_d
|
||||
|
||||
switch (format->formatId)
|
||||
{
|
||||
case CLIPRDR_FORMAT_RAW:
|
||||
case 0:
|
||||
case CB_FORMAT_PNG:
|
||||
case CB_FORMAT_JPEG:
|
||||
case CB_FORMAT_GIF:
|
||||
outbuf = xf_cliprdr_format_raw_to_wire(data, &size);
|
||||
break;
|
||||
|
||||
case CLIPRDR_FORMAT_TEXT:
|
||||
case CF_TEXT:
|
||||
outbuf = xf_cliprdr_format_text_to_wire(data, &size);
|
||||
break;
|
||||
|
||||
case CLIPRDR_FORMAT_UNICODETEXT:
|
||||
case CF_UNICODETEXT:
|
||||
outbuf = xf_cliprdr_format_unicode_text_to_wire(data, &size);
|
||||
break;
|
||||
|
||||
case CB_FORMAT_DIB:
|
||||
case CF_DIB:
|
||||
outbuf = xf_cliprdr_format_dib_to_wire(data, &size);
|
||||
break;
|
||||
|
||||
@ -743,7 +743,7 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard, XEvent*
|
||||
formatId = format->formatId;
|
||||
altFormatId = formatId;
|
||||
|
||||
if (formatId == CLIPRDR_FORMAT_RAW)
|
||||
if (formatId == 0)
|
||||
{
|
||||
if (XGetWindowProperty(xfc->display, xevent->xselectionrequest.requestor,
|
||||
clipboard->property_atom, 0, 4, 0, XA_INTEGER,
|
||||
@ -1079,7 +1079,7 @@ static int xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
|
||||
|
||||
if (xf_cliprdr_is_self_owned(clipboard))
|
||||
{
|
||||
format = xf_cliprdr_get_format_by_id(clipboard, CLIPRDR_FORMAT_RAW);
|
||||
format = xf_cliprdr_get_format_by_id(clipboard, 0);
|
||||
|
||||
XChangeProperty(xfc->display, xfc->drawable, clipboard->property_atom,
|
||||
XA_INTEGER, 32, PropModeReplace, (BYTE*) &formatId, 1);
|
||||
@ -1136,7 +1136,7 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
|
||||
switch (clipboard->data_format)
|
||||
{
|
||||
case CLIPRDR_FORMAT_RAW:
|
||||
case 0:
|
||||
case CB_FORMAT_PNG:
|
||||
case CB_FORMAT_JPEG:
|
||||
case CB_FORMAT_GIF:
|
||||
@ -1147,15 +1147,15 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
size = 0;
|
||||
break;
|
||||
|
||||
case CLIPRDR_FORMAT_TEXT:
|
||||
case CF_TEXT:
|
||||
status = xf_cliprdr_format_text_from_wire(data, size, &pDstData);
|
||||
break;
|
||||
|
||||
case CLIPRDR_FORMAT_UNICODETEXT:
|
||||
case CF_UNICODETEXT:
|
||||
status = xf_cliprdr_format_unicode_text_from_wire(data, size, &pDstData);
|
||||
break;
|
||||
|
||||
case CLIPRDR_FORMAT_DIB:
|
||||
case CF_DIB:
|
||||
status = xf_cliprdr_format_dib_from_wire(data, size, &pDstData);
|
||||
break;
|
||||
|
||||
@ -1254,35 +1254,35 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
|
||||
|
||||
n = 0;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "_FREERDP_RAW", FALSE);
|
||||
clipboard->clientFormats[n].formatId = CLIPRDR_FORMAT_RAW;
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "_FREERDP_RAW", False);
|
||||
clipboard->clientFormats[n].formatId = 0;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "UTF8_STRING", FALSE);
|
||||
clipboard->clientFormats[n].formatId = CLIPRDR_FORMAT_UNICODETEXT;
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "UTF8_STRING", False);
|
||||
clipboard->clientFormats[n].formatId = CF_UNICODETEXT;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XA_STRING;
|
||||
clipboard->clientFormats[n].formatId = CLIPRDR_FORMAT_TEXT;
|
||||
clipboard->clientFormats[n].formatId = CF_TEXT;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/png", FALSE);
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/png", False);
|
||||
clipboard->clientFormats[n].formatId = CB_FORMAT_PNG;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/jpeg", FALSE);
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/jpeg", False);
|
||||
clipboard->clientFormats[n].formatId = CB_FORMAT_JPEG;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/gif", FALSE);
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/gif", False);
|
||||
clipboard->clientFormats[n].formatId = CB_FORMAT_GIF;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/bmp", FALSE);
|
||||
clipboard->clientFormats[n].formatId = CLIPRDR_FORMAT_DIB;
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/bmp", False);
|
||||
clipboard->clientFormats[n].formatId = CF_DIB;
|
||||
n++;
|
||||
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "text/html", FALSE);
|
||||
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "text/html", False);
|
||||
clipboard->clientFormats[n].formatId = CB_FORMAT_HTML;
|
||||
clipboard->clientFormats[n].formatName = _strdup("HTML Format");
|
||||
n++;
|
||||
|
@ -29,30 +29,6 @@
|
||||
* Clipboard Formats
|
||||
*/
|
||||
|
||||
#define CLIPRDR_FORMAT_RAW 0
|
||||
#define CLIPRDR_FORMAT_TEXT 1 /* "Plain Text" */
|
||||
#define CLIPRDR_FORMAT_BITMAP 2 /* "Bitmap" */
|
||||
#define CLIPRDR_FORMAT_METAFILEPICT 3 /* "Windows Metafile" */
|
||||
#define CLIPRDR_FORMAT_SYLK 4
|
||||
#define CLIPRDR_FORMAT_DIF 5
|
||||
#define CLIPRDR_FORMAT_TIFF 6
|
||||
#define CLIPRDR_FORMAT_OEMTEXT 7 /* "OEM Text" */
|
||||
#define CLIPRDR_FORMAT_DIB 8 /* "Device Independent Bitmap (DIB)" */
|
||||
#define CLIPRDR_FORMAT_PALETTE 9
|
||||
#define CLIPRDR_FORMAT_PENDATA 10
|
||||
#define CLIPRDR_FORMAT_RIFF 11
|
||||
#define CLIPRDR_FORMAT_WAVE 12
|
||||
#define CLIPRDR_FORMAT_UNICODETEXT 13 /* "Unicode Text" */
|
||||
#define CLIPRDR_FORMAT_ENHMETAFILE 14 /* "Enhanced Metafile" */
|
||||
#define CLIPRDR_FORMAT_HDROP 15 /* "File List" */
|
||||
#define CLIPRDR_FORMAT_LOCALE 16 /* "Locale Identifier" */
|
||||
#define CLIPRDR_FORMAT_DIBV5 17
|
||||
#define CLIPRDR_FORMAT_MAX 18
|
||||
|
||||
#define CB_FORMAT_RAW 0x0000
|
||||
#define CB_FORMAT_TEXT 0x0001
|
||||
#define CB_FORMAT_DIB 0x0008
|
||||
#define CB_FORMAT_UNICODETEXT 0x000D
|
||||
#define CB_FORMAT_HTML 0xD010
|
||||
#define CB_FORMAT_PNG 0xD011
|
||||
#define CB_FORMAT_JPEG 0xD012
|
||||
|
Loading…
Reference in New Issue
Block a user