Skip to content

Commit be85eb8

Browse files
committed
add postscript pasteboard type
1 parent 085082a commit be85eb8

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

Tools/xpbs.m

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@
176176
return NSPasteboardTypePDF;
177177
}
178178

179+
if (XG_MIME_PS == type)
180+
{
181+
return NSPostScriptPboardType;
182+
}
183+
179184
if (XG_MIME_PNG == type)
180185
{
181186
return NSPasteboardTypePNG;
@@ -880,6 +885,10 @@ - (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type
880885
{
881886
[self requestData: (xType = XG_MIME_PDF)];
882887
}
888+
else if ([type isEqual: NSPostScriptPboardType])
889+
{
890+
[self requestData: (xType = XG_MIME_PS)];
891+
}
883892
else if ([type isEqual: NSHTMLPboardType])
884893
{
885894
[self requestData: (xType = XG_MIME_HTML)];
@@ -1374,6 +1383,10 @@ - (void) xSelectionNotify: (XSelectionEvent*)xEvent
13741383
{
13751384
[self setData: md];
13761385
}
1386+
else if (actual_type == XG_MIME_PS)
1387+
{
1388+
[self setData: md];
1389+
}
13771390
else if (actual_type == XG_MIME_PNG)
13781391
{
13791392
[self setData: md];
@@ -1457,7 +1470,7 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
14571470
{
14581471
unsigned numTypes = 0;
14591472
// ATTENTION: Increase this array when adding more types
1460-
Atom xTypes[22];
1473+
Atom xTypes[23];
14611474

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

1530+
if ([types containsObject: NSPostScriptPboardType])
1531+
{
1532+
xTypes[numTypes++] = XG_MIME_PS;
1533+
}
1534+
15171535
if ([types containsObject: NSPasteboardTypePNG])
15181536
{
15191537
xTypes[numTypes++] = XG_MIME_PNG;
@@ -1612,6 +1630,11 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
16121630
xEvent->target = XG_MIME_PDF;
16131631
[self xProvideSelection: xEvent];
16141632
}
1633+
else if ([types containsObject: NSPostScriptPboardType])
1634+
{
1635+
xEvent->target = XG_MIME_PS;
1636+
[self xProvideSelection: xEvent];
1637+
}
16151638
else if ([types containsObject: NSPasteboardTypePNG])
16161639
{
16171640
xEvent->target = XG_MIME_PNG;
@@ -1790,6 +1813,14 @@ - (BOOL) xProvideSelection: (XSelectionRequestEvent*)xEvent
17901813
format = 8;
17911814
numItems = [data length];
17921815
}
1816+
else if ((xEvent->target == XG_MIME_PS)
1817+
&& [types containsObject: NSPostScriptPboardType])
1818+
{
1819+
data = [_pb dataForType: NSPostScriptPboardType];
1820+
xType = xEvent->target;
1821+
format = 8;
1822+
numItems = [data length];
1823+
}
17931824
else if ((xEvent->target == XG_MIME_PNG)
17941825
&& [types containsObject: NSPasteboardTypePNG])
17951826
{

0 commit comments

Comments
 (0)