[PATCH 09/15] winemac: Remove no-longer-called clipboard entry points.

Ken Thomases ken at codeweavers.com
Sun Oct 23 13:03:28 CDT 2016


Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/winemac.drv/clipboard.c      | 294 --------------------------------------
 dlls/winemac.drv/winemac.drv.spec |   7 -
 2 files changed, 301 deletions(-)

diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c
index 75563ad..f974bf2 100644
--- a/dlls/winemac.drv/clipboard.c
+++ b/dlls/winemac.drv/clipboard.c
@@ -1232,28 +1232,6 @@ static BOOL get_clipboard_info(LPCLIPBOARDINFO cbinfo)
 
 
 /**************************************************************************
- *              release_ownership
- */
-static BOOL release_ownership(void)
-{
-    BOOL ret = FALSE;
-
-    SERVER_START_REQ(set_clipboard_info)
-    {
-        req->flags = SET_CB_RELOWNER | SET_CB_SEQNO;
-
-        if (wine_server_call_err(req))
-            ERR("Failed to set clipboard.\n");
-        else
-            ret = TRUE;
-    }
-    SERVER_END_REQ;
-
-    return ret;
-}
-
-
-/**************************************************************************
  *              macdrv_get_pasteboard_data
  */
 HANDLE macdrv_get_pasteboard_data(CFTypeRef pasteboard, UINT desired_format)
@@ -1490,283 +1468,11 @@ CFArrayRef macdrv_copy_pasteboard_formats(CFTypeRef pasteboard)
 
 
 /**************************************************************************
- *              check_clipboard_ownership
- */
-static void check_clipboard_ownership(HWND *owner)
-{
-    CLIPBOARDINFO cbinfo;
-
-    if (owner) *owner = NULL;
-
-    /* If Wine thinks we're the clipboard owner but Mac OS X thinks we're not
-       the pasteboard owner, update Wine. */
-    if (get_clipboard_info(&cbinfo) && (cbinfo.flags & CB_PROCESS))
-    {
-        if (!(cbinfo.flags & CB_OPEN) && !macdrv_is_pasteboard_owner())
-        {
-            TRACE("Lost clipboard ownership\n");
-
-            if (OpenClipboard(cbinfo.hwnd_owner))
-            {
-                /* Destroy private objects */
-                SendMessageW(cbinfo.hwnd_owner, WM_DESTROYCLIPBOARD, 0, 0);
-
-                /* Give up ownership of the windows clipboard */
-                release_ownership();
-                CloseClipboard();
-            }
-        }
-        else if (owner)
-            *owner = cbinfo.hwnd_owner;
-    }
-}
-
-
-/**************************************************************************
  *              Mac User Driver Clipboard Exports
  **************************************************************************/
 
 
 /**************************************************************************
- *              CountClipboardFormats (MACDRV.@)
- */
-INT CDECL macdrv_CountClipboardFormats(void)
-{
-    CFMutableSetRef seen_formats;
-    CFArrayRef types;
-    CFIndex count;
-    CFIndex i;
-    INT ret = 0;
-
-    TRACE("()\n");
-    check_clipboard_ownership(NULL);
-
-    seen_formats = CFSetCreateMutable(NULL, 0, NULL);
-    if (!seen_formats)
-    {
-        WARN("Failed to allocate set to track seen formats\n");
-        return 0;
-    }
-
-    types = macdrv_copy_pasteboard_types(NULL);
-    if (!types)
-    {
-        WARN("Failed to copy pasteboard types\n");
-        CFRelease(seen_formats);
-        return 0;
-    }
-
-    count = CFArrayGetCount(types);
-    TRACE("got %ld types\n", count);
-
-    for (i = 0; i < count; i++)
-    {
-        CFStringRef type = CFArrayGetValueAtIndex(types, i);
-        WINE_CLIPFORMAT* format;
-
-        format = NULL;
-        while ((format = format_for_type(format, type)))
-        {
-            TRACE("for type %s got format %p/%s\n", debugstr_cf(type), format, debugstr_format(format->format_id));
-
-            if (!CFSetContainsValue(seen_formats, (void*)format->format_id))
-            {
-                ret++;
-                CFSetAddValue(seen_formats, (void*)format->format_id);
-            }
-        }
-    }
-
-    CFRelease(types);
-    CFRelease(seen_formats);
-    TRACE(" -> %d\n", ret);
-    return ret;
-}
-
-
-/**************************************************************************
- *              EmptyClipboard (MACDRV.@)
- *
- * Empty cached clipboard data.
- */
-void CDECL macdrv_EmptyClipboard(void)
-{
-    TRACE("()\n");
-    check_clipboard_ownership(NULL);
-    macdrv_clear_pasteboard();
-}
-
-
-/**************************************************************************
- *              EndClipboardUpdate (MACDRV.@)
- */
-void CDECL macdrv_EndClipboardUpdate(void)
-{
-    TRACE("()\n");
-    check_clipboard_ownership(NULL);
-}
-
-
-/**************************************************************************
- *              EnumClipboardFormats (MACDRV.@)
- */
-UINT CDECL macdrv_EnumClipboardFormats(UINT prev_format)
-{
-    CFArrayRef formats;
-    CFIndex count;
-    CFIndex i;
-    UINT ret = 0;
-
-    TRACE("prev_format %s\n", debugstr_format(prev_format));
-    check_clipboard_ownership(NULL);
-
-    formats = macdrv_copy_pasteboard_formats(NULL);
-    if (formats)
-    {
-        count = CFArrayGetCount(formats);
-        if (prev_format)
-        {
-            i = CFArrayGetFirstIndexOfValue(formats, CFRangeMake(0, count), (void*)prev_format);
-            if (i != kCFNotFound)
-                i++;
-        }
-        else
-            i = 0;
-
-        if (i != kCFNotFound && i < count)
-            ret = (UINT)CFArrayGetValueAtIndex(formats, i);
-
-        CFRelease(formats);
-    }
-
-    TRACE(" -> %u\n", ret);
-    return ret;
-}
-
-
-/**************************************************************************
- *              GetClipboardData (MACDRV.@)
- */
-HANDLE CDECL macdrv_GetClipboardData(UINT desired_format)
-{
-    check_clipboard_ownership(NULL);
-
-    return macdrv_get_pasteboard_data(NULL, desired_format);
-}
-
-
-/**************************************************************************
- *              IsClipboardFormatAvailable (MACDRV.@)
- */
-BOOL CDECL macdrv_IsClipboardFormatAvailable(UINT desired_format)
-{
-    check_clipboard_ownership(NULL);
-    return macdrv_pasteboard_has_format(NULL, desired_format);
-}
-
-
-/**************************************************************************
- *              SetClipboardData (MACDRV.@)
- */
-BOOL CDECL macdrv_SetClipboardData(UINT format_id, HANDLE data, BOOL owner)
-{
-    HWND hwnd_owner;
-    macdrv_window window;
-    WINE_CLIPFORMAT *format;
-    CFDataRef cfdata = NULL;
-
-    check_clipboard_ownership(&hwnd_owner);
-    window = macdrv_get_cocoa_window(GetAncestor(hwnd_owner, GA_ROOT), FALSE);
-    TRACE("format_id %s data %p owner %d hwnd_owner %p window %p)\n", debugstr_format(format_id), data, owner, hwnd_owner, window);
-
-    format = natural_format_for_format(format_id);
-    if (!format && !(format = insert_clipboard_format(format_id, NULL)))
-    {
-        WARN("Failed to register clipboard format %s\n", debugstr_format(format_id));
-        return FALSE;
-    }
-
-    /* Export the data to the Mac pasteboard. */
-    if (data)
-    {
-        if (!format->export_func || !(cfdata = format->export_func(data)))
-        {
-            WARN("Failed to export %s data to type %s\n", debugstr_format(format_id), debugstr_cf(format->type));
-            return FALSE;
-        }
-    }
-
-    if (macdrv_set_pasteboard_data(format->type, cfdata, window))
-        TRACE("Set pasteboard data for type %s: %s\n", debugstr_cf(format->type), debugstr_cf(cfdata));
-    else
-    {
-        WARN("Failed to set pasteboard data for type %s: %s\n", debugstr_cf(format->type), debugstr_cf(cfdata));
-        if (cfdata) CFRelease(cfdata);
-        return FALSE;
-    }
-
-    if (cfdata) CFRelease(cfdata);
-
-    /* Find any other formats for this format_id (the exportable synthesized ones). */
-    LIST_FOR_EACH_ENTRY(format, &format_list, WINE_CLIPFORMAT, entry)
-    {
-        if (format->format_id == format_id && format->synthesized && format->export_func)
-        {
-            /* We have a synthesized format for this format ID.  Add its type to the pasteboard. */
-            TRACE("Synthesized from format %s: type %s\n", debugstr_format(format_id), debugstr_cf(format->type));
-
-            if (data)
-            {
-                cfdata = format->export_func(data);
-                if (!cfdata)
-                {
-                    WARN("Failed to export %s data to type %s\n", debugstr_format(format->format_id), debugstr_cf(format->type));
-                    continue;
-                }
-            }
-            else
-                cfdata = NULL;
-
-            if (macdrv_set_pasteboard_data(format->type, cfdata, window))
-                TRACE("    ... set pasteboard data: %s\n", debugstr_cf(cfdata));
-            else
-                WARN("    ... failed to set pasteboard data: %s\n", debugstr_cf(cfdata));
-
-            if (cfdata) CFRelease(cfdata);
-        }
-    }
-
-    if (data)
-    {
-        /* FIXME: According to MSDN, the caller is entitled to lock and read from
-           data until CloseClipboard is called.  So, we should defer this cleanup. */
-        if ((format_id >= CF_GDIOBJFIRST && format_id <= CF_GDIOBJLAST) ||
-            format_id == CF_BITMAP ||
-            format_id == CF_DIB ||
-            format_id == CF_PALETTE)
-        {
-            DeleteObject(data);
-        }
-        else if (format_id == CF_METAFILEPICT)
-        {
-            DeleteMetaFile(((METAFILEPICT *)GlobalLock(data))->hMF);
-            GlobalFree(data);
-        }
-        else if (format_id == CF_ENHMETAFILE)
-        {
-            DeleteEnhMetaFile(data);
-        }
-        else if (format_id < CF_PRIVATEFIRST || CF_PRIVATELAST < format_id)
-        {
-            GlobalFree(data);
-        }
-    }
-
-    return TRUE;
-}
-
-
-/**************************************************************************
  *              MACDRV Private Clipboard Exports
  **************************************************************************/
 
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index 2e29722..3e6619e 100644
--- a/dlls/winemac.drv/winemac.drv.spec
+++ b/dlls/winemac.drv/winemac.drv.spec
@@ -8,29 +8,22 @@
 @ cdecl Beep() macdrv_Beep
 @ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) macdrv_ChangeDisplaySettingsEx
 @ cdecl ClipCursor(ptr) macdrv_ClipCursor
-@ cdecl CountClipboardFormats() macdrv_CountClipboardFormats
 @ cdecl CreateDesktopWindow(long) macdrv_CreateDesktopWindow
 @ cdecl CreateWindow(long) macdrv_CreateWindow
 @ cdecl DestroyCursorIcon(long) macdrv_DestroyCursorIcon
 @ cdecl DestroyWindow(long) macdrv_DestroyWindow
-@ cdecl EmptyClipboard() macdrv_EmptyClipboard
-@ cdecl EndClipboardUpdate() macdrv_EndClipboardUpdate
-@ cdecl EnumClipboardFormats(long) macdrv_EnumClipboardFormats
 @ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
 @ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
-@ cdecl GetClipboardData(long) macdrv_GetClipboardData
 @ cdecl GetCursorPos(ptr) macdrv_GetCursorPos
 @ cdecl GetKeyboardLayout(long) macdrv_GetKeyboardLayout
 @ cdecl GetKeyboardLayoutList(long ptr) macdrv_GetKeyboardLayoutList
 @ 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 RegisterHotKey(long long long) macdrv_RegisterHotKey
 @ cdecl SetCapture(long long) macdrv_SetCapture
-@ cdecl SetClipboardData(long long long) macdrv_SetClipboardData
 @ cdecl SetCursor(long) macdrv_SetCursor
 @ cdecl SetCursorPos(long long) macdrv_SetCursorPos
 @ cdecl SetFocus(long) macdrv_SetFocus
-- 
2.8.2




More information about the wine-patches mailing list