From bce482c76fca80f38aba591eb687754207ba7aa4 Mon Sep 17 00:00:00 2001 From: planetmaker Date: Sun, 4 Sep 2011 17:49:08 +0000 Subject: (svn r22893) -Fix [FS#4744]: [OSX] Compilation on OSX 10.7 was broken (based on patch by leecbaker) -Add: [OSX] Support for fullscreen mode when compiled against SDK 10.7. Otherwise fullscreen mode is disabled when OpenTTD is run on OSX Lion --- src/video/cocoa/fullscreen.mm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/video/cocoa/fullscreen.mm') diff --git a/src/video/cocoa/fullscreen.mm b/src/video/cocoa/fullscreen.mm index aa28422d3..56bcc580d 100644 --- a/src/video/cocoa/fullscreen.mm +++ b/src/video/cocoa/fullscreen.mm @@ -309,8 +309,17 @@ class FullscreenSubdriver: public CocoaSubdriver { goto ERR_NO_SWITCH; } - this->window_buffer = CGDisplayBaseAddress(this->display_id); - this->window_pitch = CGDisplayBytesPerRow(this->display_id); + /* Since CGDisplayBaseAddress and CGDisplayBytesPerRow are no longer available on 10.7, + * disable until a replacement can be found. */ + if (MacOSVersionIsAtLeast(10, 7, 0)) { + this->window_buffer = NULL; + this->window_pitch = NULL; + } else { +#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7) + this->window_buffer = CGDisplayBaseAddress(this->display_id); + this->window_pitch = CGDisplayBytesPerRow(this->display_id); +#endif + } this->device_width = CGDisplayPixelsWide(this->display_id); this->device_height = CGDisplayPixelsHigh(this->display_id); @@ -565,6 +574,15 @@ public: CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp) { + /* OSX 10.7 doesn't support this way of the fullscreen driver. If we end up here + * OpenTTD was compiled without SDK 10.7 available and - and thus we don't support + * fullscreen mode in OSX 10.7 or higher, as necessary elements for this way have + * been removed from the API. + */ + if (MacOSVersionIsAtLeast(10, 7, 0)) { + return NULL; + } + FullscreenSubdriver *ret = new FullscreenSubdriver(bpp); if (!ret->ChangeResolution(width, height)) { -- cgit v1.2.3-54-g00ecf