[Xquartz-dev] 1.4.2-apple20 - copy-paste

George Peter Staplin georgeps at xmission.com
Sun Oct 26 13:08:35 PDT 2008


Quoted George Peter Staplin <georgeps at xmission.com>:
> Quoted Jeremy Huddleston <jeremyhu at apple.com>:
>> On Oct 26, 2008, at 07:53, George Peter Staplin wrote:
>>
>> ...
>>
>>> Well, that's interesting that it's still not working between     
>>> Photoshop and Gimp.  I don't have Photoshop available to test with.

>>> The Pict support was more difficult I think, because I'm not sure   
>>>   how to translate between the Pict and the various formats.  We   
>>> need   to convert Pict to TIFF, and Pict to PNG for the best   
>>> results.
>>
>> Yeah, currently we just drop it if it's Pict...
>>
>> It could also be something else that we don't handle... is there
>> documentation somewhere about what valid types can be returned by
>> [NSPasteboard types]?
>
> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html#//apple_ref/doc/uid/20000328-SW13
>
> It should be possible to build an app that uses the NSPasteboard using
> something like this:
[snip]

I have attached a compiled test app that should tell you what types  
Photoshop is providing.  I also attached the source code to the app.

You can decompress the .bz2 file with bunzip2 or bzip2 -d.


$ gcc NSPasteboard_types.m -Wall -framework AppKit -framework  
Foundation -arch i386 -arch ppc -o NSPasteboard_types

$ file NSPasteboard_types
NSPasteboard_types: Mach-O universal binary with 2 architectures
NSPasteboard_types (for architecture i386):	Mach-O executable i386
NSPasteboard_types (for architecture ppc7400):	Mach-O executable ppc

This is what it looks like after having done an Edit->Copy in the  
Gimp's window.  I think that the NSPasteboard transparently happens to  
provide PICT in this case, since we set a TIFF.
$ ./NSPasteboard_types
type public.tiff
type NeXT TIFF v4.0 pasteboard type
type com.apple.pict
type Apple PICT pasteboard type

Please tell what it reports after you have done a Photoshop Edit->Copy.

In fact, anyone that is having trouble pasting from a Mac app to an  
X11 app should give it a try, and send us the results.

Thanks,

George
-- 
http://people.freedesktop.org/~gstaplin/
-------------- next part --------------
/* This is an NSPasteboard type detection tool. */
/* Author: George Peter Staplin */
#include <stdio.h>
#include <stdlib.h>
#import <Foundation/Foundation.h>
#import <AppKit/NSPasteboard.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSPasteboard *pb = [NSPasteboard generalPasteboard];

    NSArray *array = [pb types];
    NSUInteger i;
    for(i = 0; i < [array count]; ++i) {
	NSString *typestr = [array objectAtIndex: i];

	printf("type %s\n", [typestr UTF8String]);
    }
    
    [pool release];

    return EXIT_SUCCESS;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NSPasteboard_types.bz2
Type: application/x-bzip2
Size: 2397 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/xquartz-dev/attachments/20081026/a8ba9ce9/attachment-0001.bin>


More information about the Xquartz-dev mailing list