Skip to content

Commit

Permalink
add postscript pasteboard type
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Mar 7, 2024
1 parent 085082a commit be85eb8
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion Tools/xpbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@
return NSPasteboardTypePDF;
}

if (XG_MIME_PS == type)
{
return NSPostScriptPboardType;
}

if (XG_MIME_PNG == type)
{
return NSPasteboardTypePNG;
Expand Down Expand Up @@ -880,6 +885,10 @@ - (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type
{
[self requestData: (xType = XG_MIME_PDF)];
}
else if ([type isEqual: NSPostScriptPboardType])
{
[self requestData: (xType = XG_MIME_PS)];
}
else if ([type isEqual: NSHTMLPboardType])
{
[self requestData: (xType = XG_MIME_HTML)];
Expand Down Expand Up @@ -1374,6 +1383,10 @@ - (void) xSelectionNotify: (XSelectionEvent*)xEvent
{
[self setData: md];
}
else if (actual_type == XG_MIME_PS)
{
[self setData: md];
}
else if (actual_type == XG_MIME_PNG)
{
[self setData: md];
Expand Down Expand Up @@ -1457,7 +1470,7 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
{
unsigned numTypes = 0;
// ATTENTION: Increase this array when adding more types
Atom xTypes[22];
Atom xTypes[23];

/*
* The requestor wants a list of the types we can supply it with.
Expand Down Expand Up @@ -1514,6 +1527,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
xTypes[numTypes++] = XG_MIME_PDF;
}

if ([types containsObject: NSPostScriptPboardType])
{
xTypes[numTypes++] = XG_MIME_PS;
}

if ([types containsObject: NSPasteboardTypePNG])
{
xTypes[numTypes++] = XG_MIME_PNG;
Expand Down Expand Up @@ -1612,6 +1630,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
xEvent->target = XG_MIME_PDF;
[self xProvideSelection: xEvent];
}
else if ([types containsObject: NSPostScriptPboardType])
{
xEvent->target = XG_MIME_PS;
[self xProvideSelection: xEvent];
}
else if ([types containsObject: NSPasteboardTypePNG])
{
xEvent->target = XG_MIME_PNG;
Expand Down Expand Up @@ -1790,6 +1813,14 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
format = 8;
numItems = [data length];
}
else if ((xEvent->target == XG_MIME_PS)
&& [types containsObject: NSPostScriptPboardType])
{
data = [_pb dataForType: NSPostScriptPboardType];
xType = xEvent->target;
format = 8;
numItems = [data length];
}
else if ((xEvent->target == XG_MIME_PNG)
&& [types containsObject: NSPasteboardTypePNG])
{
Expand Down

0 comments on commit be85eb8

Please sign in to comment.