c - How to copy to clipboard with X11? -
Using the framework on OS X, I can use PNG to copy it to the pasteboard (in C - obviously I use NSPasteboard with cocoa):
# Include & lt; ApplicationServices / ApplicationServices.h & gt; Int replication (zero) {pasteboard clipboard; If (pasteboard creat (clipboard clipboard, and clipboard)! = NoErr) {return -1; } If (Pasteboard Clear (Clipboard)! = NoErr) {CFRYLase (clipboard); Return -1; } Size_t lane; Char * pngbuf = createMyPNGBuffer (& amp; len); / * Somewhere defined * / if (pngbuf == faucet) {CFRYLease (clipboard); Return -1; } CFDataRef data = CFDataCreateWithBytesNoCopy (kCFAllocatorDefault, pngbuf, len, kCFAllocatorNull); If (data == faucet) {CFRYLEGE (clipboard); Free (pngbuf); Return -1; } OSStatus mistake; Err = PasteboardPutItemFlavor (clipboard, NULL, KUTTypePNG, data, 0); CFRelease (clipboard); CFRelease (data); Free (pngbuf); Return 0; }
I am interested in porting this functionality to Linux / BSD platforms. How do I create it using X?