summaryrefslogtreecommitdiff
path: root/src/video/cocoa
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:35:46 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:35:46 +0000
commit7ba4d425c80f4f99092c42b1589451afedadc4f0 (patch)
tree16835b999429ae020eaa00e1087df8ec38b11e0c /src/video/cocoa
parent2702fe88d7fe91188d2821375a5cce2a1a5a63cf (diff)
downloadopenttd-7ba4d425c80f4f99092c42b1589451afedadc4f0.tar.xz
(svn r25657) -Fix [FS#4744]: [OSX] The new 10.7 fullscreen code can now also be compiled with older SDK versions.
Diffstat (limited to 'src/video/cocoa')
-rw-r--r--src/video/cocoa/wnd_quartz.mm16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index 803384005..9914b97c9 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -240,12 +240,12 @@ void WindowQuartzSubdriver::GetDeviceInfo()
*/
bool WindowQuartzSubdriver::ToggleFullscreen()
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
- [this->window toggleFullScreen:this->window];
- return true;
-#else
+ if ([ this->window respondsToSelector:@selector(toggleFullScreen:) ]) {
+ [ this->window performSelector:@selector(toggleFullScreen:) withObject:this->window ];
+ return true;
+ }
+
return false;
-#endif
}
bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp)
@@ -280,15 +280,17 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp)
return false;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
/* Add built in full-screen support when available (OS X 10.7 and higher)
* This code actually compiles for 10.5 and later, but only makes sense in conjunction
* with the quartz fullscreen support as found only in 10.7 and later
*/
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ([this->window respondsToSelector:@selector(toggleFullScreen:)]) {
- /* Constants needed to build on pre-10.7 systems. Source: NSWindow documentation. */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+ /* Constants needed to build on pre-10.7 SDKs. Source: NSWindow documentation. */
const int NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7;
const int NSWindowFullScreenButton = 7;
+#endif
NSWindowCollectionBehavior behavior = [ this->window collectionBehavior ];
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;