Mercurial > sdl-ios-xcode
diff src/video/cocoa/SDL_cocoaclipboard.m @ 4501:0cf025066b6f
Updated Xcode project files for clipboard API
Fixed generation of SDL_revision.h when hg is in the path set up in .bash_profile
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 08 Jul 2010 06:16:27 -0700 |
parents | c2ebe3e020c6 |
children | 524dfefd554c |
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 05:43:34 2010 -0700 +++ b/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 06:16:27 2010 -0700 @@ -23,20 +23,28 @@ #include "SDL_cocoavideo.h" +static NSString * +GetTextFormat(_THIS) +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + return NSStringPboardType; +#else + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + + if (data->osversion >= 0x1060) { + return NSPasteboardTypeString; + } else { + return NSStringPboardType; + } +#endif +} int Cocoa_SetClipboardText(_THIS, const char *text) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; - NSString *format; - - if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; - } else { - format = NSStringPboardType; - } + NSString *format = GetTextFormat(_this); pool = [[NSAutoreleasePool alloc] init]; @@ -52,19 +60,12 @@ char * Cocoa_GetClipboardText(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; - NSString *format; + NSString *format = GetTextFormat(_this); NSString *available; char *text; - if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; - } else { - format = NSStringPboardType; - } - pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard]; @@ -92,19 +93,12 @@ SDL_bool Cocoa_HasClipboardText(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; - NSString *format; + NSString *format = GetTextFormat(_this); NSString *available; SDL_bool result; - if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; - } else { - format = NSStringPboardType; - } - pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard];