1.1 --- a/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 05:43:34 2010 -0700
1.2 +++ b/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 06:16:27 2010 -0700
1.3 @@ -23,20 +23,28 @@
1.4
1.5 #include "SDL_cocoavideo.h"
1.6
1.7 +static NSString *
1.8 +GetTextFormat(_THIS)
1.9 +{
1.10 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
1.11 + return NSStringPboardType;
1.12 +#else
1.13 + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1.14 +
1.15 + if (data->osversion >= 0x1060) {
1.16 + return NSPasteboardTypeString;
1.17 + } else {
1.18 + return NSStringPboardType;
1.19 + }
1.20 +#endif
1.21 +}
1.22
1.23 int
1.24 Cocoa_SetClipboardText(_THIS, const char *text)
1.25 {
1.26 - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1.27 NSAutoreleasePool *pool;
1.28 NSPasteboard *pasteboard;
1.29 - NSString *format;
1.30 -
1.31 - if (data->osversion >= 0x1060) {
1.32 - format = NSPasteboardTypeString;
1.33 - } else {
1.34 - format = NSStringPboardType;
1.35 - }
1.36 + NSString *format = GetTextFormat(_this);
1.37
1.38 pool = [[NSAutoreleasePool alloc] init];
1.39
1.40 @@ -52,19 +60,12 @@
1.41 char *
1.42 Cocoa_GetClipboardText(_THIS)
1.43 {
1.44 - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1.45 NSAutoreleasePool *pool;
1.46 NSPasteboard *pasteboard;
1.47 - NSString *format;
1.48 + NSString *format = GetTextFormat(_this);
1.49 NSString *available;
1.50 char *text;
1.51
1.52 - if (data->osversion >= 0x1060) {
1.53 - format = NSPasteboardTypeString;
1.54 - } else {
1.55 - format = NSStringPboardType;
1.56 - }
1.57 -
1.58 pool = [[NSAutoreleasePool alloc] init];
1.59
1.60 pasteboard = [NSPasteboard generalPasteboard];
1.61 @@ -92,19 +93,12 @@
1.62 SDL_bool
1.63 Cocoa_HasClipboardText(_THIS)
1.64 {
1.65 - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
1.66 NSAutoreleasePool *pool;
1.67 NSPasteboard *pasteboard;
1.68 - NSString *format;
1.69 + NSString *format = GetTextFormat(_this);
1.70 NSString *available;
1.71 SDL_bool result;
1.72
1.73 - if (data->osversion >= 0x1060) {
1.74 - format = NSPasteboardTypeString;
1.75 - } else {
1.76 - format = NSStringPboardType;
1.77 - }
1.78 -
1.79 pool = [[NSAutoreleasePool alloc] init];
1.80
1.81 pasteboard = [NSPasteboard generalPasteboard];