[client,wayland] add alternate bitmap mime types

add alternate bitmap mime types to clipboard
This commit is contained in:
Armin Novak 2024-01-31 09:49:45 +01:00 committed by akallabeth
parent ab3f44921c
commit 0d30b22a3e

View File

@ -46,16 +46,16 @@
static const char* mime_text[] = { mime_text_plain, mime_text_utf8, "UTF8_STRING",
"COMPOUND_TEXT", "TEXT", "STRING" };
static const char* mime_image[] = {
"image/png", "image/bmp", "image/x-bmp", "image/x-MS-bmp",
"image/x-icon", "image/x-ico", "image/x-win-bitmap", "image/vmd.microsoft.icon",
"application/ico", "image/ico", "image/icon", "image/jpeg",
"image/gif", "image/tiff"
};
static const char mime_png[] = "image/png";
static const char mime_webp[] = "image/webp";
static const char mime_jpg[] = "image/jpeg";
static const char mime_tiff[] = "image/tiff";
static const char mime_uri_list[] = "text/uri-list";
static const char mime_html[] = "text/html";
static const char mime_bmp[] = "image/bmp";
#define BMP_MIME_LIST "image/bmp", "image/x-bmp", "image/x-MS-bmp", "image/x-win-bitmap"
static const char* mime_bitmap[] = { BMP_MIME_LIST };
static const char* mime_image[] = { mime_png, mime_webp, mime_jpg, mime_tiff, BMP_MIME_LIST };
static const char mime_gnome_copied_files[] = "x-special/gnome-copied-files";
static const char mime_mate_copied_files[] = "x-special/mate-copied-files";
@ -287,9 +287,15 @@ static BOOL wlf_cliprdr_add_client_format(wfClipboard* clipboard, const char* mi
}
else if (wlf_mime_is_image(mime))
{
UINT32 formatId = ClipboardGetFormatId(clipboard->system, mime_bmp);
wfl_cliprdr_add_client_format_id(clipboard, formatId);
for (size_t x = 0; x < ARRAYSIZE(mime_image); x++)
{
const char* mime_bmp = mime_image[x];
UINT32 formatId = ClipboardGetFormatId(clipboard->system, mime_bmp);
if (formatId != 0)
wfl_cliprdr_add_client_format_id(clipboard, formatId);
}
wfl_cliprdr_add_client_format_id(clipboard, CF_DIB);
wfl_cliprdr_add_client_format_id(clipboard, CF_TIFF);
}
else if (wlf_mime_is_file(mime))
{
@ -539,7 +545,10 @@ static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char*
else if (wlf_mime_is_image(mime))
{
request.responseMime = mime;
request.responseFormat = CF_DIB;
if (strcmp(mime, mime_tiff) == 0)
request.responseFormat = CF_TIFF;
else
request.responseFormat = CF_DIB;
}
if (request.responseMime != NULL)
@ -749,7 +758,11 @@ wlf_cliprdr_server_format_data_request(CliprdrClientContext* context,
case CF_DIB:
case CF_DIBV5:
mime = mime_bmp;
mime = mime_bitmap[0];
break;
case CF_TIFF:
mime = mime_tiff;
break;
default: