diff options
author | michi_cc <michi_cc@openttd.org> | 2016-10-31 19:29:01 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2016-10-31 19:29:01 +0000 |
commit | 94b3965989f23363a2863da7e819d6e8a8ff1214 (patch) | |
tree | 28799cb5fbd64a2c60c3c1288cbb128186722763 /src | |
parent | 51052f4961cea7203d2291b9b70ae865602b469e (diff) | |
download | openttd-94b3965989f23363a2863da7e819d6e8a8ff1214.tar.xz |
(svn r27675) -Fix [FS#6502]: [OSX] Building with 10.11 or 10.12 SDKs.
Diffstat (limited to 'src')
-rw-r--r-- | src/music/cocoa_m.cpp | 8 | ||||
-rw-r--r-- | src/os/macosx/osx_stdafx.h | 13 | ||||
-rw-r--r-- | src/video/cocoa/wnd_quartz.mm | 22 |
3 files changed, 32 insertions, 11 deletions
diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index a201984ae..925dc21ab 100644 --- a/src/music/cocoa_m.cpp +++ b/src/music/cocoa_m.cpp @@ -30,6 +30,10 @@ #include "../safeguards.h" +#if !defined(HAVE_OSX_1011_SDK) +#define kMusicSequenceFile_AnyType 0 +#endif + static FMusicDriver_Cocoa iFMusicDriver_Cocoa; @@ -68,7 +72,7 @@ static void DoSetVolume() * risk compilation errors. The header AudioComponent.h * was introduced in 10.6 so use it to decide which * type definition to use. */ -#ifdef __AUDIOCOMPONENT_H__ +#if defined(__AUDIOCOMPONENT_H__) || defined(HAVE_OSX_107_SDK) AudioComponentDescription desc; #else ComponentDescription desc; @@ -159,7 +163,7 @@ void MusicDriver_Cocoa::PlaySong(const char *filename) #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if (MacOSVersionIsAtLeast(10, 5, 0)) { - if (MusicSequenceFileLoad(_sequence, url, 0, 0) != noErr) { + if (MusicSequenceFileLoad(_sequence, url, kMusicSequenceFile_AnyType, 0) != noErr) { DEBUG(driver, 0, "cocoa_m: Failed to load MIDI file"); CFRelease(url); return; diff --git a/src/os/macosx/osx_stdafx.h b/src/os/macosx/osx_stdafx.h index 35b3f434a..4e16b5e63 100644 --- a/src/os/macosx/osx_stdafx.h +++ b/src/os/macosx/osx_stdafx.h @@ -13,6 +13,17 @@ #define MACOS_STDAFX_H +#include <AvailabilityMacros.h> + +/* We assume if these macros are defined, the SDK is also at least this version or later. */ +#ifdef MAC_OS_X_VERSION_10_7 +#define HAVE_OSX_107_SDK +#endif + +#ifdef MAC_OS_X_VERSION_10_11 +#define HAVE_OSX_1011_SDK +#endif + /* It would seem that to ensure backward compability 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 @@ -57,8 +68,6 @@ # error "Compiling 64 bits without _SQ64 set! (or vice versa)" #endif -#include <AvailabilityMacros.h> - /* Name conflict */ #define Rect OTTDRect #define Point OTTDPoint diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index c93a1f6fb..795a311bc 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -110,15 +110,23 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace() static CGColorSpaceRef colorSpace = NULL; if (colorSpace == NULL) { - CMProfileRef sysProfile; - - if (CMGetSystemProfile(&sysProfile) == noErr) { - colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysProfile); - CMCloseProfile(sysProfile); - } else { - colorSpace = CGColorSpaceCreateDeviceRGB(); +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) + if (MacOSVersionIsAtLeast(10, 5, 0)) { + colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID()); + } else +#endif + { +#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(HAVE_OSX_1011_SDK) + CMProfileRef sysProfile; + if (CMGetSystemProfile(&sysProfile) == noErr) { + colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysProfile); + CMCloseProfile(sysProfile); + } +#endif } + if (colorSpace == NULL) colorSpace = CGColorSpaceCreateDeviceRGB(); + if (colorSpace == NULL) error("Could not get system colour space. You might need to recalibrate your monitor."); } |