diff --git a/Tools/xpbs.m b/Tools/xpbs.m index 520dd122..a3e2ca3e 100644 --- a/Tools/xpbs.m +++ b/Tools/xpbs.m @@ -166,6 +166,11 @@ return NSHTMLPboardType; } + if (XG_MIME_URI == type) + { + return NSURLPboardType; + } + if (XG_MIME_PDF == type) { return NSPasteboardTypePDF; @@ -879,6 +884,10 @@ - (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type { [self requestData: (xType = XG_MIME_HTML)]; } + else if ([type isEqual: NSURLPboardType]) + { + [self requestData: (xType = XG_MIME_URI)]; + } // FIXME: Support more types else { @@ -1353,6 +1362,10 @@ - (void) xSelectionNotify: (XSelectionEvent*)xEvent { [self setData: md]; } + else if (actual_type == XG_MIME_URI) + { + [self setData: md]; + } else if (actual_type == XG_MIME_TIFF) { [self setData: md]; @@ -1444,7 +1457,7 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent { unsigned numTypes = 0; // ATTENTION: Increase this array when adding more types - Atom xTypes[21]; + Atom xTypes[22]; /* * The requestor wants a list of the types we can supply it with. @@ -1486,6 +1499,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent xTypes[numTypes++] = XG_MIME_XHTML; } + if ([types containsObject: NSURLPboardType]) + { + xTypes[numTypes++] = XG_MIME_URI; + } + if ([types containsObject: NSTIFFPboardType]) { xTypes[numTypes++] = XG_MIME_TIFF; @@ -1604,6 +1622,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent xEvent->target = XG_MIME_HTML; [self xProvideSelection: xEvent]; } + else if ([types containsObject: NSURLPboardType]) + { + xEvent->target = XG_MIME_URI; + [self xProvideSelection: xEvent]; + } } else if (xEvent->target == XG_MULTIPLE) { @@ -1743,6 +1766,14 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent format = 8; numItems = [data length]; } + else if ((xEvent->target == XG_MIME_URI) + && [types containsObject: NSURLPboardType]) + { + data = [_pb dataForType: NSURLPboardType]; + xType = xEvent->target; + format = 8; + numItems = [data length]; + } else if ((xEvent->target == XG_MIME_TIFF) && [types containsObject: NSTIFFPboardType]) {