|
@@ -37,34 +37,28 @@ GetTextFormat(_THIS)
|
|
|
|
|
|
int
|
|
|
Cocoa_SetClipboardText(_THIS, const char *text)
|
|
|
+{ @autoreleasepool
|
|
|
{
|
|
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
|
|
- NSAutoreleasePool *pool;
|
|
|
NSPasteboard *pasteboard;
|
|
|
NSString *format = GetTextFormat(_this);
|
|
|
|
|
|
- pool = [[NSAutoreleasePool alloc] init];
|
|
|
-
|
|
|
pasteboard = [NSPasteboard generalPasteboard];
|
|
|
data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
|
|
|
[pasteboard setString:[NSString stringWithUTF8String:text] forType:format];
|
|
|
|
|
|
- [pool release];
|
|
|
-
|
|
|
return 0;
|
|
|
-}
|
|
|
+}}
|
|
|
|
|
|
char *
|
|
|
Cocoa_GetClipboardText(_THIS)
|
|
|
+{ @autoreleasepool
|
|
|
{
|
|
|
- NSAutoreleasePool *pool;
|
|
|
NSPasteboard *pasteboard;
|
|
|
NSString *format = GetTextFormat(_this);
|
|
|
NSString *available;
|
|
|
char *text;
|
|
|
|
|
|
- pool = [[NSAutoreleasePool alloc] init];
|
|
|
-
|
|
|
pasteboard = [NSPasteboard generalPasteboard];
|
|
|
available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]];
|
|
|
if ([available isEqualToString:format]) {
|
|
@@ -82,10 +76,8 @@ Cocoa_GetClipboardText(_THIS)
|
|
|
text = SDL_strdup("");
|
|
|
}
|
|
|
|
|
|
- [pool release];
|
|
|
-
|
|
|
return text;
|
|
|
-}
|
|
|
+}}
|
|
|
|
|
|
SDL_bool
|
|
|
Cocoa_HasClipboardText(_THIS)
|
|
@@ -101,13 +93,11 @@ Cocoa_HasClipboardText(_THIS)
|
|
|
|
|
|
void
|
|
|
Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
|
|
|
+{ @autoreleasepool
|
|
|
{
|
|
|
- NSAutoreleasePool *pool;
|
|
|
NSPasteboard *pasteboard;
|
|
|
NSInteger count;
|
|
|
|
|
|
- pool = [[NSAutoreleasePool alloc] init];
|
|
|
-
|
|
|
pasteboard = [NSPasteboard generalPasteboard];
|
|
|
count = [pasteboard changeCount];
|
|
|
if (count != data->clipboard_count) {
|
|
@@ -116,9 +106,7 @@ Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
|
|
|
}
|
|
|
data->clipboard_count = count;
|
|
|
}
|
|
|
-
|
|
|
- [pool release];
|
|
|
-}
|
|
|
+}}
|
|
|
|
|
|
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
|
|
|