diff --git a/Tools/xpbs.m b/Tools/xpbs.m index 4e20d1b8..b5ae9adf 100644 --- a/Tools/xpbs.m +++ b/Tools/xpbs.m @@ -853,6 +853,11 @@ - (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType: - requestData XG_MIME_TIFF"); [self requestData: (xType = XG_MIME_TIFF)]; } + else if ([type isEqual: NSPasteboardTypePNG]) + { + NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType: - requestData XG_MIME_PNG"); + [self requestData: XG_MIME_PNG]; + } // FIXME: Support more types else { @@ -1326,6 +1331,10 @@ - (void) xSelectionNotify: (XSelectionEvent*)xEvent { [self setData: md]; } + else if (actual_type == XG_MIME_PNG) + { + [self setData: md]; + } else if (actual_type == XA_ATOM) { // Used when requesting TARGETS to get available types @@ -1405,7 +1414,7 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent { unsigned numTypes = 0; // ATTENTION: Increase this array when adding more types - Atom xTypes[17]; + Atom xTypes[18]; /* * The requestor wants a list of the types we can supply it with. @@ -1446,6 +1455,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent xTypes[numTypes++] = XG_MIME_TIFF; } + if ([types containsObject: NSPasteboardTypePNG]) + { + xTypes[numTypes++] = XG_MIME_PNG; + } + xType = XA_ATOM; format = 32; data = [NSData dataWithBytes: (const void*)xTypes @@ -1534,6 +1548,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent xEvent->target = XG_MIME_TIFF; [self xProvideSelection: xEvent]; } + else if ([types containsObject: NSPasteboardTypePNG]) + { + xEvent->target = XG_MIME_PNG; + [self xProvideSelection: xEvent]; + } } else if (xEvent->target == XG_MULTIPLE) { @@ -1672,6 +1691,14 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent format = 8; numItems = [data length]; } + else if ((xEvent->target == XG_MIME_PNG) + && [types containsObject: NSPasteboardTypePNG]) + { + data = [_pb dataForType: NSPasteboardTypePNG]; + xType = xEvent->target; + format = 8; + numItems = [data length]; + } // FIXME: Support more types else {