From 9ac1e82c82fd8dff10e4ad50b7224b3758652498 Mon Sep 17 00:00:00 2001 From: Yves Sablonier Date: Sun, 17 Feb 2013 00:06:03 +0100 Subject: [PATCH] Adding directive for osx sdk 10.5 in ClipBoardCocoa.mm --- src/Scripting/ClipboardCocoa.mm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Scripting/ClipboardCocoa.mm b/src/Scripting/ClipboardCocoa.mm index 8e0b0abae..d6bb63897 100644 --- a/src/Scripting/ClipboardCocoa.mm +++ b/src/Scripting/ClipboardCocoa.mm @@ -16,6 +16,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + #include "NasalClipboard.hxx" #include @@ -66,9 +68,13 @@ class ClipboardCocoa: public NasalClipboard if( type == CLIPBOARD ) { - NSPasteboard* pboard = [NSPasteboard generalPasteboard]; - NSString* nstext = [pboard stringForType:NSPasteboardTypeString]; - return stdStringFromCocoa(nstext); + NSPasteboard* pboard = [NSPasteboard generalPasteboard]; + #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + NSString* nstext = [pboard stringForType:NSStringPboardType]; + #else // > 10.5 + NSString* nstext = [pboard stringForType:NSPasteboardTypeString]; + #endif // MAC_OS_X_VERSION_MIN_REQUIRED + return stdStringFromCocoa(nstext); } return ""; @@ -85,8 +91,16 @@ class ClipboardCocoa: public NasalClipboard { NSPasteboard* pboard = [NSPasteboard generalPasteboard]; NSString* nstext = stdStringToCocoa(text); - [pboard clearContents]; - [pboard setString:nstext forType:NSPasteboardTypeString]; + #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + NSString* type = NSStringPboardType; + NSArray* types = [NSArray arrayWithObjects: type, nil]; + [pboard declareTypes:types owner:nil]; + [pboard setString:nstext forType: NSStringPboardType]; + #else // > 10.5 + NSString* type = NSPasteboardTypeString; + [pboard clearContents]; + [pboard setString:nstext forType:NSPasteboardTypeString]; + #endif // MAC_OS_X_VERSION_MIN_REQUIRED return true; } -- 2.39.5