diff options
author | planetmaker <planetmaker@openttd.org> | 2011-09-04 17:49:08 +0000 |
---|---|---|
committer | planetmaker <planetmaker@openttd.org> | 2011-09-04 17:49:08 +0000 |
commit | bce482c76fca80f38aba591eb687754207ba7aa4 (patch) | |
tree | 1e4a56ff32a9dc08d1ec78cdd619c0b4f4c5bb56 /src/video/cocoa/fullscreen.mm | |
parent | 5001b27cced8fb84283392cbbc44b67c30513d9e (diff) | |
download | openttd-bce482c76fca80f38aba591eb687754207ba7aa4.tar.xz |
(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
Diffstat (limited to 'src/video/cocoa/fullscreen.mm')
-rw-r--r-- | src/video/cocoa/fullscreen.mm | 22 |
1 files changed, 20 insertions, 2 deletions
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)) { |