mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-31 01:11:00 +00:00
Report all available types in debug
This commit is contained in:
parent
e66906ef38
commit
6a221b4dc7
1 changed files with 44 additions and 26 deletions
70
Tools/xpbs.m
70
Tools/xpbs.m
|
@ -869,11 +869,15 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
*/
|
*/
|
||||||
- (NSArray*) availableTypes
|
- (NSArray*) availableTypes
|
||||||
{
|
{
|
||||||
NSMutableArray *types;
|
NSMutableArray *types;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
unsigned int count;
|
NSMutableString *txt = nil;
|
||||||
unsigned int i;
|
NSMutableString *rtf = nil;
|
||||||
Atom *targets;
|
NSMutableString *std = nil;
|
||||||
|
NSMutableString *bad = nil;
|
||||||
|
unsigned int count;
|
||||||
|
unsigned int i;
|
||||||
|
Atom *targets;
|
||||||
|
|
||||||
NSDebugLLog(@"Pbs", @"%@ availableTypes called", [[self osPb] name]);
|
NSDebugLLog(@"Pbs", @"%@ availableTypes called", [[self osPb] name]);
|
||||||
|
|
||||||
|
@ -887,20 +891,23 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
targets = (Atom*)[data bytes];
|
targets = (Atom*)[data bytes];
|
||||||
types = [NSMutableArray arrayWithCapacity: count];
|
types = [NSMutableArray arrayWithCapacity: count];
|
||||||
|
|
||||||
NSDebugLLog(@"Pbs", @"%@ availableTypes: %d types available",
|
|
||||||
[[self osPb] name], count);
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
Atom type;
|
Atom type;
|
||||||
|
char *name;
|
||||||
|
|
||||||
type = targets[i];
|
type = targets[i];
|
||||||
|
name = XGetAtomName(xDisplay, type);
|
||||||
|
|
||||||
if ((type == XG_UTF8_STRING)
|
if ((type == XG_UTF8_STRING)
|
||||||
|| (type == XA_STRING)
|
|| (type == XA_STRING)
|
||||||
|| (type == XG_TEXT)
|
|| (type == XG_TEXT)
|
||||||
|| (type == XG_MIME_PLAIN))
|
|| (type == XG_MIME_PLAIN))
|
||||||
{
|
{
|
||||||
|
if (nil == txt)
|
||||||
|
txt = [NSMutableString stringWithFormat: @" string:%s", name];
|
||||||
|
else
|
||||||
|
[txt appendFormat: @",%s", name];
|
||||||
[types addObject: NSStringPboardType];
|
[types addObject: NSStringPboardType];
|
||||||
}
|
}
|
||||||
else if (type == XG_FILE_NAME)
|
else if (type == XG_FILE_NAME)
|
||||||
|
@ -911,6 +918,10 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
|| (type == XG_MIME_APP_RTF)
|
|| (type == XG_MIME_APP_RTF)
|
||||||
|| (type == XG_MIME_TEXT_RICHTEXT))
|
|| (type == XG_MIME_TEXT_RICHTEXT))
|
||||||
{
|
{
|
||||||
|
if (nil == rtf)
|
||||||
|
rtf = [NSMutableString stringWithFormat: @" rich-text:%s", name];
|
||||||
|
else
|
||||||
|
[rtf appendFormat: @",%s", name];
|
||||||
[types addObject: NSRTFPboardType];
|
[types addObject: NSRTFPboardType];
|
||||||
}
|
}
|
||||||
else if (type == XG_MIME_TIFF)
|
else if (type == XG_MIME_TIFF)
|
||||||
|
@ -918,29 +929,36 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
[types addObject: NSTIFFPboardType];
|
[types addObject: NSTIFFPboardType];
|
||||||
}
|
}
|
||||||
else if ((type == XG_TARGETS)
|
else if ((type == XG_TARGETS)
|
||||||
|| (type == XG_TIMESTAMP)
|
|| (type == XG_TIMESTAMP)
|
||||||
|| (type == XG_OWNER_OS)
|
|| (type == XG_OWNER_OS)
|
||||||
|| (type == XG_USER)
|
|| (type == XG_USER)
|
||||||
|| (type == XG_HOST_NAME)
|
|| (type == XG_HOST_NAME)
|
||||||
|| (type == XG_HOSTNAME)
|
|| (type == XG_HOSTNAME)
|
||||||
|| (type == XG_MULTIPLE))
|
|| (type == XG_MULTIPLE))
|
||||||
{
|
{
|
||||||
// Standard types
|
// Standard types
|
||||||
|
if (nil == std)
|
||||||
|
std = [NSMutableString stringWithFormat: @" standard:%s", name];
|
||||||
|
else
|
||||||
|
[std appendFormat: @",%s", name];
|
||||||
}
|
}
|
||||||
// FIXME: Support more types
|
// FIXME: Support more types
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *name = XGetAtomName(xDisplay, type);
|
if (nil == bad)
|
||||||
|
bad = [NSMutableString stringWithFormat: @" unsupported:%s", name];
|
||||||
|
else
|
||||||
|
[bad appendFormat: @",%s", name];
|
||||||
// FIXME: We should rather add this type to the
|
// FIXME: We should rather add this type to the
|
||||||
// pasteboard as a string.
|
// pasteboard as a string.
|
||||||
NSDebugLLog(@"Pbs", @"Unsupported selection type '%s' available",
|
|
||||||
name);
|
|
||||||
XFree(name);
|
|
||||||
}
|
}
|
||||||
|
XFree(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDebugLLog(@"Pbs", @"Available types: %@ ", types);
|
NSDebugLLog(@"Pbs", @"%@ availableTypes: %d types available: %@%@%@%@%@",
|
||||||
|
[[self osPb] name], count, types,
|
||||||
|
(txt ? txt : @""), (rtf ? rtf : @""), (std ? std : @""), (bad ? bad : @""));
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue