Mac-Pasteboard
view release on metacpan or search on metacpan
cleanup:
return stat;
}
#undef ROUTINE
#define ROUTINE "pbl_copy"
OSStatus pbl_copy (
void * pbref,
const unsigned char * cdata,
size_t size,
unsigned long id,
const char * cflavor,
PB_FLAVOR_FLAGS flags
) {
CFDataRef pbdata = NULL;
CFStringRef sflavor = NULL;
OSStatus stat;
PasteboardSyncFlags sync;
LOG_ENTRY;
LOG_ARG_P (pbref, ", ");
LOG_ARG_S (cdata, ", ");
LOG_ARG_L (size, ", ");
LOG_ARG_L (id, ", ");
LOG_ARG_S (cflavor, ")\n");
/*
* It seems that I _can_ in fact get rid of the following, but
* I must do a clear _somewhere_ in the code to put data on the
* pasteboard.
stat = PasteboardClear (pbref);
CHECK ("PasteboardClear", stat)
*
* The other thing I could do here is a synchronize (q.v.), and
* then clear if we do not own the pasteboard.
*/
/* The synch is really only needed if we have two objects
* representing the same pasteboard. */
sync = PasteboardSynchronize (pbref);
if (cdata == NULL) {
pbdata = CFDataCreate (NULL, (const unsigned char *) "", 0);
} else {
pbdata = CFDataCreate (NULL, cdata, size);
}
sflavor = PBLX_FLAVOR (cflavor);
LOG_CF ("Flavor", sflavor);
stat = PasteboardPutItemFlavor (pbref, (PasteboardItemID) id,
sflavor, pbdata, (PasteboardFlavorFlags) flags);
CHECK ("PasteboardPutItemFlavor", stat)
( run in 0.621 second using v1.01-cache-2.11-cpan-454fe037f31 )