summaryrefslogtreecommitdiff
path: root/src/video/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/cocoa')
-rw-r--r--src/video/cocoa/cocoa_v.h5
-rw-r--r--src/video/cocoa/cocoa_v.mm17
-rw-r--r--src/video/cocoa/wnd_quartz.mm7
-rw-r--r--src/video/cocoa/wnd_quickdraw.mm2
4 files changed, 29 insertions, 2 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
index 2be0100df..34b931261 100644
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -61,11 +61,16 @@ public:
extern CocoaSubdriver* _cocoa_subdriver;
CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp);
+
+#ifdef ENABLE_COCOA_QUICKDRAW
CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp);
+#endif
+#ifdef ENABLE_COCOA_QUARTZ
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp);
#endif
+#endif
void QZ_GameSizeChanged();
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index db8ef2c5b..90434c5d6 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -232,6 +232,7 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
{
CocoaSubdriver *ret;
+#ifdef ENABLE_COCOA_QUARTZ
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
/* The reason for the version mismatch is due to the fact that the 10.4 binary needs to work on 10.5 as well. */
if (MacOSVersionIsAtLeast(10, 5, 0)) {
@@ -239,9 +240,25 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
if (ret != NULL) return ret;
}
#endif
+#endif
+#ifdef ENABLE_COCOA_QUICKDRAW
ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp);
if (ret != NULL) return ret;
+#endif
+
+#ifdef ENABLE_COCOA_QUARTZ
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ /*
+ * If we get here we are running 10.4 or earlier and either openttd was compiled without the quickdraw driver
+ * or it failed to load for some reason. Fall back to Quartz if possible even though that driver is slower.
+ */
+ if (MacOSVersionIsAtLeast(10, 4, 0)) {
+ ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
+ if (ret != NULL) return ret;
+ }
+#endif
+#endif
return NULL;
}
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index 493e80260..00a8ad9ba 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -7,6 +7,7 @@
******************************************************************************/
#ifdef WITH_COCOA
+#ifdef ENABLE_COCOA_QUARTZ
#include <AvailabilityMacros.h>
@@ -782,8 +783,8 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
{
WindowQuartzSubdriver *ret;
- if (!MacOSVersionIsAtLeast(10, 5, 0)) {
- DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.5 or later.");
+ if (!MacOSVersionIsAtLeast(10, 4, 0)) {
+ DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.4 or later.");
return NULL;
}
@@ -802,5 +803,7 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
return ret;
}
+
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */
+#endif /* ENABLE_COCOA_QUARTZ */
#endif /* WITH_COCOA */
diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm
index dc1dc34b2..35d4bae0d 100644
--- a/src/video/cocoa/wnd_quickdraw.mm
+++ b/src/video/cocoa/wnd_quickdraw.mm
@@ -7,6 +7,7 @@
******************************************************************************/
#ifdef WITH_COCOA
+#ifdef ENABLE_COCOA_QUICKDRAW
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3
@@ -817,4 +818,5 @@ CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp
return ret;
}
+#endif /* ENABLE_COCOA_QUICKDRAW */
#endif /* WITH_COCOA */