mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-31 09:21:26 +00:00
PNG support in copy and paste; NSPasteboardTypePNG XG_MIME_PNG
This commit is contained in:
parent
707c5239e3
commit
c787d26af2
1 changed files with 28 additions and 1 deletions
29
Tools/xpbs.m
29
Tools/xpbs.m
|
@ -853,6 +853,11 @@ static int xFixesEventBase;
|
||||||
NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType: - requestData XG_MIME_TIFF");
|
NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType: - requestData XG_MIME_TIFF");
|
||||||
[self requestData: (xType = 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
|
// FIXME: Support more types
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1326,6 +1331,10 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
[self setData: md];
|
[self setData: md];
|
||||||
}
|
}
|
||||||
|
else if (actual_type == XG_MIME_PNG)
|
||||||
|
{
|
||||||
|
[self setData: md];
|
||||||
|
}
|
||||||
else if (actual_type == XA_ATOM)
|
else if (actual_type == XA_ATOM)
|
||||||
{
|
{
|
||||||
// Used when requesting TARGETS to get available types
|
// Used when requesting TARGETS to get available types
|
||||||
|
@ -1405,7 +1414,7 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
unsigned numTypes = 0;
|
unsigned numTypes = 0;
|
||||||
// ATTENTION: Increase this array when adding more types
|
// 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.
|
* The requestor wants a list of the types we can supply it with.
|
||||||
|
@ -1446,6 +1455,11 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
xTypes[numTypes++] = XG_MIME_TIFF;
|
xTypes[numTypes++] = XG_MIME_TIFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([types containsObject: NSPasteboardTypePNG])
|
||||||
|
{
|
||||||
|
xTypes[numTypes++] = XG_MIME_PNG;
|
||||||
|
}
|
||||||
|
|
||||||
xType = XA_ATOM;
|
xType = XA_ATOM;
|
||||||
format = 32;
|
format = 32;
|
||||||
data = [NSData dataWithBytes: (const void*)xTypes
|
data = [NSData dataWithBytes: (const void*)xTypes
|
||||||
|
@ -1534,6 +1548,11 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
xEvent->target = XG_MIME_TIFF;
|
xEvent->target = XG_MIME_TIFF;
|
||||||
[self xProvideSelection: xEvent];
|
[self xProvideSelection: xEvent];
|
||||||
}
|
}
|
||||||
|
else if ([types containsObject: NSPasteboardTypePNG])
|
||||||
|
{
|
||||||
|
xEvent->target = XG_MIME_PNG;
|
||||||
|
[self xProvideSelection: xEvent];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (xEvent->target == XG_MULTIPLE)
|
else if (xEvent->target == XG_MULTIPLE)
|
||||||
{
|
{
|
||||||
|
@ -1672,6 +1691,14 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
format = 8;
|
format = 8;
|
||||||
numItems = [data length];
|
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
|
// FIXME: Support more types
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue