Skip to content

Commit

Permalink
Improve debug loging showing method entry/exit informmation
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Mar 5, 2024
1 parent b8933e4 commit 707c523
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions Tools/xpbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -811,47 +811,62 @@ - (void) requestData: (Atom)xType

- (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type
{
Atom xType = 0;
BOOL debug = GSDebugSet(@"Pbs");

if (debug)
{
NSLog(@"Enter [%@ -pasteboard:provideDataForType:] %@, %@",
[[self osPb] name], pb, type);
}
[self setData: nil];

NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType:%@", type);
/*
* If this gets called, a GNUstep object wants the pasteboard contents
* and a plain old X application is providing them, so we must grab
* the info.
*/
if ([type isEqual: NSStringPboardType])
{
[self requestData: XG_UTF8_STRING];
[self requestData: (xType = XG_UTF8_STRING)];
if ([self data] == nil)
[self requestData: XG_MIME_UTF8];
[self requestData: (xType = XG_MIME_UTF8)];
if ([self data] == nil)
[self requestData: XA_STRING];
[self requestData: (xType = XA_STRING)];
if ([self data] == nil)
[self requestData: XG_TEXT];
[self requestData: (xType = XG_TEXT)];
}
else if ([type isEqual: NSFilenamesPboardType])
{
[self requestData: XG_FILE_NAME];
[self requestData: (xType = XG_FILE_NAME)];
}
else if ([type isEqual: NSRTFPboardType])
{
[self requestData: XG_MIME_RTF];
[self requestData: (xType = XG_MIME_RTF)];
if ([self data] == nil)
[self requestData: XG_MIME_APP_RTF];
[self requestData: (xType = XG_MIME_APP_RTF)];
if ([self data] == nil)
[self requestData: XG_MIME_TEXT_RICHTEXT];
[self requestData: (xType = XG_MIME_TEXT_RICHTEXT)];
}
else if ([type isEqual: NSTIFFPboardType])
{
NSDebugLLog(@"Pbs", @"pasteboard: provideDataForType: - requestData XG_MIME_TIFF");
[self requestData: XG_MIME_TIFF];
[self requestData: (xType = XG_MIME_TIFF)];
}
// FIXME: Support more types
else
{
NSDebugLLog(@"Pbs", @"Request for non-string info from X pasteboard: %@", type);
}
[pb setData: [self data] forType: type];
if (debug)
{
char *name = XGetAtomName(xDisplay, xType);

NSLog(@"Exit [%@ -pasteboard:provideDataForType:] %s",
[[self osPb] name], name);
XFree(name);
}
}

- (void) setData: (NSData*)obj
Expand Down Expand Up @@ -939,7 +954,7 @@ - (NSArray*) availableTypes

if (debug)
{
NSLog(@"%@ -availableTypes entry", [[self osPb] name]);
NSLog(@"Enter [%@ -availableTypes]", [[self osPb] name]);
}

[self setData: nil];
Expand All @@ -949,7 +964,8 @@ - (NSArray*) availableTypes
{
if (debug)
{
NSLog(@"%@ -availableTypes exit: 0", [[self osPb] name]);
NSLog(@"Exit [%@ -availableTypes]\n\tNo types found.",
[[self osPb] name]);
}
return [NSArray array];
}
Expand Down Expand Up @@ -1003,11 +1019,11 @@ - (NSArray*) availableTypes

if (debug)
{
NSLog(@"%@ -availableTypes exit: %u\n"
@"\tmapped: %u, duplicates: %u, standard: %u, unsupported: %u\n"
NSLog(@"Exit [%@ -availableTypes]\n"
@"\tmapped:%u, duplicates:%u, standard:%u, unsupported:%u, total:%u\n"
@"\tavailable: %@\n\tunsupported: (%@)",
[[self osPb] name], count,
(unsigned)[types count], duplicates, standard, unsupported,
[[self osPb] name], (unsigned)[types count],
duplicates, standard, unsupported, (unsigned)count,
types, bad ? (id)bad : (id)@"");
}

Expand Down

0 comments on commit 707c523

Please sign in to comment.