Mercurial > hg > openttd
changeset 8092:77a59057707a draft
(svn r11653) -Feature: [OSX] Allow windowed mode subdrivers to be disabled at compile time.
author | egladil <egladil@openttd.org> |
---|---|
date | Mon, 17 Dec 2007 07:47:21 +0000 |
parents | c632f5a65d88 |
children | 64b9133f0cf8 |
files | config.lib src/video/cocoa/cocoa_v.h src/video/cocoa/cocoa_v.mm src/video/cocoa/wnd_quartz.mm src/video/cocoa/wnd_quickdraw.mm |
diffstat | 5 files changed, 62 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/config.lib +++ b/config.lib @@ -43,6 +43,8 @@ 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 @@ 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 @@ --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 @@ 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 @@ 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 @@ 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"
--- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -61,11 +61,16 @@ 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();
--- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -232,6 +232,7 @@ { 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 @@ 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; }
--- 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 @@ { 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 @@ return ret; } + #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */ +#endif /* ENABLE_COCOA_QUARTZ */ #endif /* WITH_COCOA */
--- 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 @@ return ret; } +#endif /* ENABLE_COCOA_QUICKDRAW */ #endif /* WITH_COCOA */