Commit Graph

62 Commits

Author SHA1 Message Date
Piotr Caban 1cd883fcb5 winemac: Don't update clipboard if its content didn't change.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-30 21:49:49 +02:00
Ken Thomases c95d2de3dd winemac: Ignore clipboard updates provoked by our own call to GetClipboardData().
During a call to GetClipboardData(), the app may be asked to render the data
for a promised format.  This will cause us to receive WM_CLIPBOARDUPDATE.

Almost always, the app will have just rendered the requested format and not
made any other changes.  Therefore, we don't need to rebuild the Mac pasteboard
from the Win32 clipboard.  Doing so can cause a race with the other Mac app
which is querying the pasteboard (for a paste operation, for example).  We
basically delete the data we _just_ added and rebuild the list of available
types.  The symptom is that the other Mac app sees the available types change
and maybe be incomplete.

In theory, the Windows app could make other changes to the clipboard and this
change would cause us to fail to convey them to the Mac pasteboard.  I consider
that very unlikely and the tradeoff to improve the common case is worth it.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-03 09:35:18 +01:00
Ken Thomases 52e20d82f8 winemac: Ignore an additional expected error in the clipboard pipe communication code.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:42:06 +01:00
Ken Thomases 961703427d winemac: Export HTML Format clipboard data to the public.html pasteboard type.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:42:05 +01:00
Ken Thomases ed0de54f45 winemac: Add basic support for importing the public.html pasteboard format.
Continue exporting in the original format under org.winehq.registered.HTML Format
for fidelity when copying and pasting within Wine.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:41:42 +01:00
Ken Thomases 5f5807cbfe winemac: Periodically check for pasteboard changes using a timer.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:25 +01:00
Ken Thomases 525c0b1795 winemac: Don't update the clipboard if the Mac pasteboard hasn't changed.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:19 +01:00
Ken Thomases 3208d1497a winemac: Change some clipboard functions to void return.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:06 +01:00
Lauri Kenttä f447b644a5 winemac.drv: Compare handle to INVALID_HANDLE_VALUE, not NULL.
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-06 15:02:35 +01:00
Ken Thomases 2a09548b59 winemac: Use min() rather than MIN(), which is not reliably defined.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-26 18:39:14 +02:00
Ken Thomases eba417a477 winemac: Detect loss of ownership of the Mac pasteboard and update the clipboard manager status.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:18 +02:00
Ken Thomases e7568d342a winemac: Implement the UpdateClipboard entry point to have the clipboard manager update its status.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:15 +02:00
Ken Thomases fa573553bc winemac: Run a single clipboard manager thread per window station, inside the explorer process.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:10 +02:00
Ken Thomases 782959168a winemac: Change macdrv_copy_pasteboard_formats() to return a C array instead of a CFArray.
Renamed it to macdrv_get_pasteboard_formats(), since the "copy" was meant to
convey Core Foundation ownership semantics which no longer apply.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:06 +02:00
Ken Thomases 019983e2c6 winemac: Reimplement query_pasteboard_data() using the user32 clipboard API.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:09:27 +02:00
Ken Thomases 33b9494ecf winemac: Simplify format_for_type() and callers since there's at most one format for a given Mac pasteboard type.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:09:24 +02:00
Ken Thomases 9cedf37205 winemac: Remove no-longer-called clipboard entry points.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:09:22 +02:00
Ken Thomases 1837210159 winemac: Use GetDIBits to retrieve the bitmap header when exporting a bitmap.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:09:18 +02:00
Ken Thomases 12ea83acb5 winemac: Clamp the number of colors to <= 256 in bitmap_info_size().
… as is done in user32's and gdi32's version of the same function.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:08:34 +02:00
Ken Thomases 8b75e66a5b winemac: Don't export/import CF_TEXT or CF_OEMTEXT to/from Mac-native data types.
The relevant Mac-native types, public.utf16-plain-text and public.utf8-plain-text,
are handled by CF_UNICODETEXT and user32 handles the synthesis of CF_TEXT and
CF_OEMTEXT from that.

CF_TEXT and CF_OEMTEXT are still exported and imported with a Wine-specific
type to preserve cross-prefix copy/paste fidelity.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:06:04 +02:00
Ken Thomases c22590b697 winemac: Don't export/import CF_BITMAP or CF_DIBV5 to/from a Mac-native data type.
The relevant Mac-native type, com.microsoft.bmp, is handled by CF_DIB and
user32 handles the synthesis of CF_BITMAP and CF_DIBV5 from that.

CF_BITMAP and CF_DIBV5 are still exported and imported with a Wine-specific
type to preserve cross-prefix copy/paste fidelity.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:05:51 +02:00
Ken Thomases 40eb776aaa winemac: Remove support for converting among standard clipboard formats.
User32 handles that now.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:05:47 +02:00
Ken Thomases b47183812a winemac: Remove support for owner-displayed clipboard formats.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:02:57 +02:00
Ken Thomases e846da321a winemac: Convert old-Mac-style line breaks (CR) to Windows-style CRLF when importing UTF-16.
At least one Mac app, TextWrangler, puts UTF-16 data on the pasteboard with
lines separated by CR (although it uses LF for the UTF-8 form of the same text).
Other Mac apps handle it properly; we should, too.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:02:52 +02:00
Ken Thomases 861541c5e6 winemac: Allocate clipboard data as GMEM_FIXED.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:02:42 +02:00
Charles Davis 1dcf51f0fc winemac.drv: Move create_bitmap_from_dib() above the import/export functions.
Signed-off-by: Charles Davis <cdavis5x@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-05 01:27:52 +09:00
Charles Davis 9a18a62fb2 winemac.drv: Fix our handling of bitmaps on the clipboard.
Signed-off-by: Charles Davis <cdavis5x@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-02 23:27:26 +09:00
Alexandre Julliard 070a82e743 user32: Merge the AcquireClipboard and EmptyClipboard driver entry points. 2015-06-03 18:46:53 +09:00
Alexandre Julliard b7c340de73 user32: Get rid of the unused parameter in the EmptyClipboard driver entry point. 2015-06-03 18:46:53 +09:00
Ken Thomases eac789c6da winemac: Put clipboard formats synthesized from other standard clipboard formats at the end of the list. 2013-11-22 13:59:33 +01:00
Ken Thomases f2640745b3 winemac: Make macdrv_EnumClipboardFormats() always use macdrv_copy_pasteboard_formats().
This makes sure that the formats are enumerated in a consistent order.
2013-11-22 13:59:08 +01:00
Ken Thomases b28a014c44 winemac: Cache the "natural" clipboard format entry associated with synthesized built-in entries at startup. 2013-11-22 13:59:03 +01:00
Ken Thomases ee53ea4b93 winemac: Add a function to find the "natural" clipboard format entry for a format ID. 2013-11-22 13:58:48 +01:00
Ken Thomases a0061e0a30 winemac: Synthesize text clipboard formats in CF_TEXT, CF_OEMTEXT, CF_UNICODETEXT order. 2013-11-22 13:58:42 +01:00
Ken Thomases d98dbf8fbd winemac: Synthesize CF_METAFILEPICT from CF_ENHMETAFILE. 2013-11-22 13:58:33 +01:00
Ken Thomases 53089bff2e winemac: Synthesize CF_ENHMETAFILE from CF_METAFILEPICT. 2013-11-22 13:58:28 +01:00
Ken Thomases 29236cce4c winemac: Add support for the CF_ENHMETAFILE clipboard format. 2013-11-22 13:58:20 +01:00
Ken Thomases cdad61369c winemac: Add support for the CF_METAFILEPICT clipboard format. 2013-11-22 13:58:12 +01:00
Ken Thomases a983cfb01d winemac: Ignore Mac-originating pasteboard types which aren't mapped to standard clipboard formats.
New clipboard formats had been registered for them, but that was pointless.
No Windows app would ever expect or make use of such clipboard formats or the
associated pasteboard data.
2013-11-22 13:58:02 +01:00
Ken Thomases aa53603135 winemac: Reduce duplicated code by consolidating exit paths from format_for_type(). 2013-11-06 15:52:48 +01:00
Ken Thomases 7c0c30b4d6 winemac: Fix search for clipboard format matching a pasteboard type so it can fail when it should.
It had been acting as though the last registered clipboard format always
matched any pasteboard type.
2013-11-06 15:52:45 +01:00
Ken Thomases 3ececfd2a5 winemac: Fix a leak in macdrv_CountClipboardFormats(). (Clang). 2013-10-21 10:46:44 +02:00
Ken Thomases 49197e811b winemac: Rename some confusingly-named variables. 2013-10-21 10:46:33 +02:00
Ken Thomases c7f8e71ab6 winemac: Fix some bytes-vs-WCHARs length computation bugs in the UTF-16 clipboard support. 2013-10-21 10:46:29 +02:00
Charles Davis a157c7bd81 winemac.drv: Support the public UTF-16 type for Unicode text. 2013-08-22 22:06:43 +02:00
Ken Thomases cba4bcb47f winemac: Handle failure to get clipboard format name; don't use uninitialized buffer. 2013-04-09 11:25:05 +02:00
Ken Thomases 678f086904 winemac: Support CFSTR_SHELLURLW (UniformResourceLocator) clipboard format, mapped to public.url. 2013-03-26 12:12:28 +01:00
Ken Thomases 36343f520b winemac: Specify import and export functions explicitly in builtin_format_names[]. 2013-03-26 12:12:26 +01:00
Ken Thomases 7993bd3d90 winemac: Implement support for drag-and-drop. 2013-03-14 12:03:32 +01:00
Ken Thomases fb5794a764 winemac: Extract new function from macdrv_EnumClipboardFormats() parameterized by the target pasteboard. 2013-03-14 12:02:49 +01:00