Codechange: [OSX] Use more exact enum names where introduced with the 10.12 SDK.

The enum values still have the exact same numerical values, but the 10.12
SDK introduced more explicit names (e.g. like NSEventTypeApplicationDefined
instead of NSApplicationDefined) for several enum constants.
Use them when available.
This commit is contained in:
Michael Lutz
2021-06-21 23:37:49 +02:00
parent 8c1b89e107
commit 0d5d3083bd
4 changed files with 63 additions and 20 deletions

View File

@@ -191,13 +191,13 @@ const char *GetCurrentLocale(const char *)
bool GetClipboardContents(char *buffer, const char *last)
{
NSPasteboard *pb = [ NSPasteboard generalPasteboard ];
NSArray *types = [ NSArray arrayWithObject:NSStringPboardType ];
NSArray *types = [ NSArray arrayWithObject:NSPasteboardTypeString ];
NSString *bestType = [ pb availableTypeFromArray:types ];
/* Clipboard has no text data available. */
if (bestType == nil) return false;
NSString *string = [ pb stringForType:NSStringPboardType ];
NSString *string = [ pb stringForType:NSPasteboardTypeString ];
if (string == nil || [ string length ] == 0) return false;
strecpy(buffer, [ string UTF8String ], last);

View File

@@ -26,6 +26,10 @@
#define HAVE_OSX_1011_SDK
#endif
#ifdef MAC_OS_X_VERSION_10_12
#define HAVE_OSX_1012_SDK
#endif
/* It would seem that to ensure backward compatibility we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
#ifndef MAC_OS_X_VERSION_10_3
#define MAC_OS_X_VERSION_10_3 1030