Navigation Menu

Skip to content

Commit

Permalink
Remove use of MAC_OS_X_VERSION_10_x macro.
Browse files Browse the repository at this point in the history
If you look for MAC_OS_X_VERSION_10_6 in the 10.4 SDK (for example), it'll
 fail to do the right thing in the preprocessor.
  • Loading branch information
icculus committed Aug 25, 2011
1 parent 6b2c128 commit ccde1ce
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -24,8 +24,8 @@
#include "SDL_QuartzVideo.h"
#include "SDL_QuartzWindow.h"

/* Fixed in Snow Leopard */
#if __MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6

#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 /* Fixed in Snow Leopard */
/*
Add methods to get at private members of NSScreen.
Since there is a bug in Apple's screen switching code
Expand Down Expand Up @@ -104,7 +104,7 @@ static int QZ_SetColors (_THIS, int first_color,

#if FORCE_OLD_API
#undef MAC_OS_X_VERSION_MIN_REQUIRED
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_5
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
#endif

static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
Expand All @@ -119,7 +119,7 @@ static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
{
/* we only own these references in the 10.6+ API. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
CGDisplayModeRelease((CGDisplayModeRef) moderef);
}
Expand All @@ -129,7 +129,7 @@ static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
static void QZ_ReleaseDisplayModeList(_THIS, CFArrayRef mode_list)
{
/* we only own these references in the 10.6+ API. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
CFRelease(mode_list);
}
Expand Down Expand Up @@ -231,7 +231,7 @@ static void QZ_GetModeInfo(_THIS, const void *_mode, Uint32 *w, Uint32 *h, Uint3
return;
}

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
CGDisplayModeRef vidmode = (CGDisplayModeRef) _mode;
CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
Expand All @@ -249,7 +249,7 @@ static void QZ_GetModeInfo(_THIS, const void *_mode, Uint32 *w, Uint32 *h, Uint3
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
CFDictionaryRef vidmode = (CFDictionaryRef) _mode;
CFNumberGetValue (
Expand Down Expand Up @@ -296,13 +296,13 @@ static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format)
}
#endif

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
save_mode = CGDisplayCopyDisplayMode(display_id);
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
save_mode = CGDisplayCurrentMode(display_id);
}
Expand Down Expand Up @@ -380,13 +380,13 @@ static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format)
client_mode_list = NULL;
}

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
mode_list = CGDisplayCopyAllDisplayModes(display_id, NULL);
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
mode_list = CGDisplayAvailableModes(display_id);
}
Expand Down Expand Up @@ -484,13 +484,13 @@ static SDL_bool QZ_WindowPosition(_THIS, int *x, int *y)

static CGError QZ_SetDisplayMode(_THIS, const void *vidmode)
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
return CGDisplaySetDisplayMode(display_id, (CGDisplayModeRef) vidmode, NULL);
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
return CGDisplaySwitchToMode(display_id, (CFDictionaryRef) vidmode);
}
Expand Down Expand Up @@ -576,7 +576,7 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop)
return NULL;
}

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
if (IS_SNOW_LEOPARD_OR_LATER(this)) {
/* apparently, we have to roll our own now. :/ */
CFArrayRef mode_list = CGDisplayCopyAllDisplayModes(display_id, NULL);
Expand All @@ -600,7 +600,7 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop)
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
boolean_t exact = 0;
best = CGDisplayBestModeForParameters(display_id, bpp, w, h, &exact);
Expand Down

0 comments on commit ccde1ce

Please sign in to comment.