From 35159d5db3b9e739f640d04616f0ee131e65c70b Mon Sep 17 00:00:00 2001 From: egladil Date: Sun, 25 Nov 2007 14:43:16 +0000 Subject: (svn r11521) -Codechange: [OSX] Check what the running os version is in a cleaner way. --- src/video/cocoa/cocoa_v.mm | 15 +++++++++++---- src/video/cocoa/event.mm | 3 +++ src/video/cocoa/fullscreen.mm | 1 + src/video/cocoa/wnd_quartz.mm | 7 +++++++ src/video/cocoa/wnd_quickdraw.mm | 6 ++++++ 5 files changed, 28 insertions(+), 4 deletions(-) (limited to 'src/video') diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 9aad12012..24a7a4086 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -8,6 +8,7 @@ #ifdef WITH_COCOA +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3 #include #import @@ -229,13 +230,17 @@ void QZ_GameSizeChanged() static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp) { - long sysVersion; + CocoaSubdriver *ret; - if (Gestalt(gestaltSystemVersion, &sysVersion) == noErr && sysVersion >= 0x1040) { - return QZ_CreateWindowQuartzSubdriver(width, height, bpp); + if (MacOSVersionIsAtLeast(10, 4, 0)) { + ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp); + if (ret != NULL) return ret; } - return QZ_CreateWindowQuickdrawSubdriver(width, height, bpp); + ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp); + if (ret != NULL) return ret; + + return NULL; } @@ -282,6 +287,8 @@ const char *VideoDriver_Cocoa::Start(const char * const *parm) { int width, height, bpp; + if (!MacOSVersionIsAtLeast(10, 3, 0)) return "The Cocoa video driver requires Mac OS X 10.3 or later."; + if (_cocoa_video_started) return "Already started"; _cocoa_video_started = true; diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index 18002b439..76e148e9a 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -8,6 +8,9 @@ #ifdef WITH_COCOA +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3 +#include + #import #import /* gettimeofday */ #import /* for MAXPATHLEN */ diff --git a/src/video/cocoa/fullscreen.mm b/src/video/cocoa/fullscreen.mm index a6d2a3387..f7612f6c9 100644 --- a/src/video/cocoa/fullscreen.mm +++ b/src/video/cocoa/fullscreen.mm @@ -8,6 +8,7 @@ #ifdef WITH_COCOA +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3 #include #import diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index 847bdc4b5..9df8525f3 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -8,6 +8,7 @@ #ifdef WITH_COCOA +#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4 #include #import @@ -685,6 +686,7 @@ CGPoint WindowQuartzSubdriver::PrivateLocalToCG(NSPoint* p) p->y = window_height - p->y; *p = [ qzview convertPoint:*p toView: nil ]; + *p = [ window convertBaseToScreen:*p ]; p->y = device_height - p->y; @@ -779,6 +781,11 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp) { WindowQuartzSubdriver *ret; + if (!MacOSVersionIsAtLeast(10, 4, 0)) { + DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.4 or later."); + return NULL; + } + if (bpp != 8 && bpp != 32) { DEBUG(driver, 0, "The cocoa quartz subdriver only supports 8 and 32 bpp."); return NULL; diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm index 92bcdd4ee..9a19c7a3d 100644 --- a/src/video/cocoa/wnd_quickdraw.mm +++ b/src/video/cocoa/wnd_quickdraw.mm @@ -8,6 +8,8 @@ #ifdef WITH_COCOA +#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 #include #import @@ -796,6 +798,10 @@ CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp { WindowQuickdrawSubdriver *ret; + if (MacOSVersionIsAtLeast(10, 4, 0)) { + DEBUG(driver, 0, "The cocoa quickdraw subdriver is not recommended for Mac OS X 10.4 or later."); + } + if (bpp != 8 && bpp != 32) { DEBUG(driver, 0, "The cocoa quickdraw subdriver only supports 8 and 32 bpp."); return NULL; -- cgit v1.2.3-70-g09d2