Module: wine Branch: master Commit: f2640745b33dfab362f86d60a25e4ef3ba810957 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f2640745b33dfab362f86d60a2...
Author: Ken Thomases ken@codeweavers.com Date: Fri Nov 22 04:31:46 2013 -0600
winemac: Make macdrv_EnumClipboardFormats() always use macdrv_copy_pasteboard_formats().
This makes sure that the formats are enumerated in a consistent order.
---
dlls/winemac.drv/clipboard.c | 43 +++++++++++------------------------------ 1 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index b65391d..0b13df9 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -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);