Implement Pasting (with command-V) in OS X

This commit is contained in:
Thomas Bernard
2018-07-04 17:21:40 +02:00
parent d0ac732d8e
commit c72b3ce5b7
3 changed files with 43 additions and 5 deletions

View File

@@ -397,3 +397,23 @@ int main (int argc, char **argv)
#endif
return 0;
}
const char * get_paste_board(void)
{
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
// only available with 10.6+
//NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
//NSDictionary *options = [NSDictionary dictionary];
//BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options];
//if (ok) {
// NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
// NSString * string = [objectsToPaste objectAtIndex:0];
// NSLog(@"%@", string);
//}
//NSLog(@"types : %@", [pasteboard types]);
NSString * string = [pasteboard stringForType:NSStringPboardType];
NSLog(@"pasteboard content : %@", string);
return [string UTF8String];
}