summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoregladil <egladil@openttd.org>2007-12-17 07:47:21 +0000
committeregladil <egladil@openttd.org>2007-12-17 07:47:21 +0000
commit2885c660603b09547dfa95bd1fd10e5b8696a05b (patch)
treefdea3d4a12c2e7ff0a33ec90ed275295f25ace28
parent93c3e0d6ada1761431bb39060bbc3a7ab95803f1 (diff)
downloadopenttd-2885c660603b09547dfa95bd1fd10e5b8696a05b.tar.xz
(svn r11653) -Feature: [OSX] Allow windowed mode subdrivers to be disabled at compile time.
-rw-r--r--config.lib34
-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
5 files changed, 62 insertions, 3 deletions
diff --git a/config.lib b/config.lib
index cd980c95f..115507342 100644
--- a/config.lib
+++ b/config.lib
@@ -43,6 +43,8 @@ set_default() {
enable_universal="1"
enable_osx_g5="0"
enable_unicode="1"
+ enable_cocoa_quartz="1"
+ enable_cocoa_quickdraw="1"
with_distcc="1"
with_ccache="1"
with_osx_sysroot="1"
@@ -63,7 +65,7 @@ set_default() {
with_psp_config="1"
with_threads="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir enable_debug enable_desync_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config with_threads CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir enable_debug enable_desync_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_osx_sysroot enable_universal enable_osx_g5 enable_unicode enable_cocoa_quartz enable_cocoa_quickdraw with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config with_threads CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -173,6 +175,13 @@ detect_params() {
--enable-unicode) enable_unicode="2";;
--enable-unicode=*) enable_unicode="$optarg";;
+ --disable-cocoa-quartz) enable_cocoa_quartz="0";;
+ --enable-cocoa-quartz) enable_cocoa_quartz="2";;
+ --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
+ --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
+ --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
+ --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
+
--with-sdl) with_sdl="2";;
--without-sdl) with_sdl="0";;
--with-sdl=*) with_sdl="$optarg";;
@@ -943,6 +952,14 @@ make_cflags_and_ldflags() {
if [ "$with_cocoa" != "0" ]; then
CFLAGS="$CFLAGS -DWITH_COCOA"
LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit"
+
+ if [ "$enable_cocoa_quartz" != "0" ]; then
+ CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
+ fi
+
+ if [ "$enable_cocoa_quickdraw" != "0" ]; then
+ CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
+ fi
fi
if [ "$with_zlib" != "0" ]; then
@@ -1552,6 +1569,19 @@ detect_cocoa() {
fi
log 1 "checking COCOA... found"
+
+
+ if [ "$enable_cocoa_quartz" != "0" ]; then
+ log 1 "checking whether to enable the Quartz window subdriver... yes"
+ else
+ log 1 "checking whether to enable the Quartz window subdriver... no"
+ fi
+
+ if [ "$enable_cocoa_quickdraw" != "0" ]; then
+ log 1 "checking whether to enable the Quickdraw window subdriver... yes"
+ else
+ log 1 "checking whether to enable the Quickdraw window subdriver... no"
+ fi
}
detect_library() {
@@ -2203,6 +2233,8 @@ showhelp() {
echo " --enable-translator enable extra output for translators"
echo " --enable-universal enable universal builds (OSX ONLY)"
echo " --enable-osx-g5 enables optimalizations for G5 (OSX ONLY)"
+ echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
+ echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
echo " --disable-unicode disable unicode support to build win9x"
echo " version (Win32 ONLY)"
echo " --disable-network disable network support"
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 */