Ken Thomases : winemac: Implement IsClipboardFormatAvailable() with support for text formats.

Alexandre Julliard julliard at winehq.org
Mon Mar 11 16:24:52 CDT 2013


Module: wine
Branch: master
Commit: af10783e18f59c62829ea0fd723270829ead1ada
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=af10783e18f59c62829ea0fd723270829ead1ada

Author: Ken Thomases <ken at codeweavers.com>
Date:   Sun Mar 10 22:58:09 2013 -0500

winemac: Implement IsClipboardFormatAvailable() with support for text formats.

---

 dlls/winemac.drv/clipboard.c      |   43 +++++++++++++++++++++++++++++++++++++
 dlls/winemac.drv/winemac.drv.spec |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c
index 90788ce..3f15a37 100644
--- a/dlls/winemac.drv/clipboard.c
+++ b/dlls/winemac.drv/clipboard.c
@@ -647,6 +647,49 @@ INT CDECL macdrv_CountClipboardFormats(void)
 
 
 /**************************************************************************
+ *              IsClipboardFormatAvailable (MACDRV.@)
+ */
+BOOL CDECL macdrv_IsClipboardFormatAvailable(UINT desired_format)
+{
+    CFArrayRef types;
+    int count;
+    UINT i;
+    BOOL found = FALSE;
+
+    TRACE("desired_format %s\n", debugstr_format(desired_format));
+
+    types = macdrv_copy_pasteboard_types();
+    if (!types)
+    {
+        WARN("Failed to copy pasteboard types\n");
+        return FALSE;
+    }
+
+    count = CFArrayGetCount(types);
+    TRACE("got %d types\n", count);
+
+    for (i = 0; !found && i < count; i++)
+    {
+        CFStringRef type = CFArrayGetValueAtIndex(types, i);
+        WINE_CLIPFORMAT* format;
+
+        format = NULL;
+        while (!found && (format = format_for_type(format, type)))
+        {
+            TRACE("for type %s got format %s\n", debugstr_cf(type), debugstr_format(format->format_id));
+
+            if (format->format_id == desired_format)
+                found = TRUE;
+        }
+    }
+
+    CFRelease(types);
+    TRACE(" -> %d\n", found);
+    return found;
+}
+
+
+/**************************************************************************
  *              MACDRV Private Clipboard Exports
  **************************************************************************/
 
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index 809ee2a..f5d1f15 100644
--- a/dlls/winemac.drv/winemac.drv.spec
+++ b/dlls/winemac.drv/winemac.drv.spec
@@ -20,6 +20,7 @@
 @ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName
 @ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText
 @ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo
+@ cdecl IsClipboardFormatAvailable(long) macdrv_IsClipboardFormatAvailable
 @ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx
 @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
 @ cdecl ScrollDC(long long long ptr ptr long ptr) macdrv_ScrollDC




More information about the wine-cvs mailing list