Commit f2640745 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Make macdrv_EnumClipboardFormats() always use macdrv_copy_pasteboard_formats().

This makes sure that the formats are enumerated in a consistent order.
parent b28a014c
......@@ -1921,6 +1921,7 @@ void CDECL macdrv_EndClipboardUpdate(void)
*/
UINT CDECL macdrv_EnumClipboardFormats(UINT prev_format)
{
CFArrayRef formats;
CFIndex count;
CFIndex i;
UINT ret = 0;
......@@ -1928,43 +1929,23 @@ UINT CDECL macdrv_EnumClipboardFormats(UINT prev_format)
TRACE("prev_format %s\n", debugstr_format(prev_format));
check_clipboard_ownership(NULL);
if (prev_format)
formats = macdrv_copy_pasteboard_formats(NULL);
if (formats)
{
CFArrayRef formats = macdrv_copy_pasteboard_formats(NULL);
if (formats)
count = CFArrayGetCount(formats);
if (prev_format)
{
count = CFArrayGetCount(formats);
i = CFArrayGetFirstIndexOfValue(formats, CFRangeMake(0, count), (void*)prev_format);
if (i != kCFNotFound && i + 1 < count)
ret = (UINT)CFArrayGetValueAtIndex(formats, i + 1);
CFRelease(formats);
if (i != kCFNotFound)
i++;
}
}
else
{
CFArrayRef types = macdrv_copy_pasteboard_types(NULL);
if (types)
{
count = CFArrayGetCount(types);
TRACE("got %ld types\n", count);
for (i = 0; i < count; i++)
{
CFStringRef type = CFArrayGetValueAtIndex(types, i);
WINE_CLIPFORMAT *format = format_for_type(NULL, type);
else
i = 0;
if (format)
{
ret = format->format_id;
break;
}
}
if (i != kCFNotFound && i < count)
ret = (UINT)CFArrayGetValueAtIndex(formats, i);
CFRelease(types);
}
else
WARN("Failed to copy pasteboard types\n");
CFRelease(formats);
}
TRACE(" -> %u\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment