winemac: Enable pasteboard functions to operate on arbitrary pasteboards.
... not just the general pasteboard (although the general pasteboard is still the default).
This commit is contained in:
parent
761ad810d9
commit
4ae5b106f8
|
@ -1326,7 +1326,7 @@ INT CDECL macdrv_CountClipboardFormats(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
types = macdrv_copy_pasteboard_types();
|
||||
types = macdrv_copy_pasteboard_types(NULL);
|
||||
if (!types)
|
||||
{
|
||||
WARN("Failed to copy pasteboard types\n");
|
||||
|
@ -1396,7 +1396,7 @@ UINT CDECL macdrv_EnumClipboardFormats(UINT prev_format)
|
|||
TRACE("prev_format %s\n", debugstr_format(prev_format));
|
||||
check_clipboard_ownership(NULL);
|
||||
|
||||
types = macdrv_copy_pasteboard_types();
|
||||
types = macdrv_copy_pasteboard_types(NULL);
|
||||
if (!types)
|
||||
{
|
||||
WARN("Failed to copy pasteboard types\n");
|
||||
|
@ -1490,7 +1490,7 @@ HANDLE CDECL macdrv_GetClipboardData(UINT desired_format)
|
|||
TRACE("desired_format %s\n", debugstr_format(desired_format));
|
||||
check_clipboard_ownership(NULL);
|
||||
|
||||
types = macdrv_copy_pasteboard_types();
|
||||
types = macdrv_copy_pasteboard_types(NULL);
|
||||
if (!types)
|
||||
{
|
||||
WARN("Failed to copy pasteboard types\n");
|
||||
|
@ -1526,7 +1526,7 @@ HANDLE CDECL macdrv_GetClipboardData(UINT desired_format)
|
|||
|
||||
if (best_format)
|
||||
{
|
||||
CFDataRef pasteboard_data = macdrv_copy_pasteboard_data(best_type);
|
||||
CFDataRef pasteboard_data = macdrv_copy_pasteboard_data(NULL, best_type);
|
||||
|
||||
TRACE("got pasteboard data for type %s: %s\n", debugstr_cf(best_type), debugstr_cf(pasteboard_data));
|
||||
|
||||
|
@ -1556,7 +1556,7 @@ BOOL CDECL macdrv_IsClipboardFormatAvailable(UINT desired_format)
|
|||
TRACE("desired_format %s\n", debugstr_format(desired_format));
|
||||
check_clipboard_ownership(NULL);
|
||||
|
||||
types = macdrv_copy_pasteboard_types();
|
||||
types = macdrv_copy_pasteboard_types(NULL);
|
||||
if (!types)
|
||||
{
|
||||
WARN("Failed to copy pasteboard types\n");
|
||||
|
@ -1758,7 +1758,7 @@ BOOL query_pasteboard_data(HWND hwnd, CFStringRef type)
|
|||
|
||||
if (!types)
|
||||
{
|
||||
types = macdrv_copy_pasteboard_types();
|
||||
types = macdrv_copy_pasteboard_types(NULL);
|
||||
if (!types)
|
||||
{
|
||||
WARN("Failed to copy pasteboard types\n");
|
||||
|
|
|
@ -53,8 +53,9 @@ int macdrv_is_pasteboard_owner(void)
|
|||
* the pasteboard, or NULL on error. The caller is responsible for
|
||||
* releasing the returned array with CFRelease().
|
||||
*/
|
||||
CFArrayRef macdrv_copy_pasteboard_types(void)
|
||||
CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard)
|
||||
{
|
||||
NSPasteboard* pb = (NSPasteboard*)pasteboard;
|
||||
__block CFArrayRef ret = NULL;
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
@ -79,8 +80,11 @@ CFArrayRef macdrv_copy_pasteboard_types(void)
|
|||
OnMainThread(^{
|
||||
@try
|
||||
{
|
||||
NSPasteboard* pb = [NSPasteboard generalPasteboard];
|
||||
NSArray* types = [pb types];
|
||||
NSPasteboard* local_pb = pb;
|
||||
NSArray* types;
|
||||
|
||||
if (!local_pb) local_pb = [NSPasteboard generalPasteboard];
|
||||
types = [local_pb types];
|
||||
|
||||
// If there are any types understood by NSBitmapImageRep, then we
|
||||
// can offer all of the types that it can output, too. For example,
|
||||
|
@ -115,22 +119,24 @@ CFArrayRef macdrv_copy_pasteboard_types(void)
|
|||
* if there's no such type on the pasteboard. The caller is responsible
|
||||
* for releasing the returned data object with CFRelease().
|
||||
*/
|
||||
CFDataRef macdrv_copy_pasteboard_data(CFStringRef type)
|
||||
CFDataRef macdrv_copy_pasteboard_data(CFTypeRef pasteboard, CFStringRef type)
|
||||
{
|
||||
NSPasteboard* pb = (NSPasteboard*)pasteboard;
|
||||
__block NSData* ret = nil;
|
||||
|
||||
OnMainThread(^{
|
||||
@try
|
||||
{
|
||||
NSPasteboard* pb = [NSPasteboard generalPasteboard];
|
||||
if ([pb availableTypeFromArray:[NSArray arrayWithObject:(NSString*)type]])
|
||||
ret = [[pb dataForType:(NSString*)type] copy];
|
||||
NSPasteboard* local_pb = pb;
|
||||
if (!local_pb) local_pb = [NSPasteboard generalPasteboard];
|
||||
if ([local_pb availableTypeFromArray:[NSArray arrayWithObject:(NSString*)type]])
|
||||
ret = [[local_pb dataForType:(NSString*)type] copy];
|
||||
else
|
||||
{
|
||||
NSNumber* bitmapType = [BitmapOutputTypeMap objectForKey:(NSString*)type];
|
||||
if (bitmapType)
|
||||
{
|
||||
NSArray* reps = [NSBitmapImageRep imageRepsWithPasteboard:pb];
|
||||
NSArray* reps = [NSBitmapImageRep imageRepsWithPasteboard:local_pb];
|
||||
ret = [NSBitmapImageRep representationOfImageRepsInArray:reps
|
||||
usingType:[bitmapType unsignedIntegerValue]
|
||||
properties:nil];
|
||||
|
|
|
@ -304,8 +304,8 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat
|
|||
|
||||
|
||||
/* clipboard */
|
||||
extern CFArrayRef macdrv_copy_pasteboard_types(void) DECLSPEC_HIDDEN;
|
||||
extern CFDataRef macdrv_copy_pasteboard_data(CFStringRef type) DECLSPEC_HIDDEN;
|
||||
extern CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard) DECLSPEC_HIDDEN;
|
||||
extern CFDataRef macdrv_copy_pasteboard_data(CFTypeRef pasteboard, CFStringRef type) DECLSPEC_HIDDEN;
|
||||
extern int macdrv_is_pasteboard_owner(void) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_clear_pasteboard(void) DECLSPEC_HIDDEN;
|
||||
extern int macdrv_set_pasteboard_data(CFStringRef type, CFDataRef data, macdrv_window w) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue