Skip to content

Commit

Permalink
Fixed bug 1363 - SDL 1.2 hg does not compile against the 10.5 SDK
Browse files Browse the repository at this point in the history
Alexei Svitkine 2012-01-05 15:55:47 PST
Open SDL.xcodeproject and change SDK to 10.5 and try to build. It will fail.

There are two errors:

1. Incorrect SDK version check in src/cdrom/macosx/AudioFilePlayer.h, which
redefines FSIORefNum. FSIORefNum is actually defined in the 10.5 SDK, but not
in the 10.4 one.

2. Code in SDL_QuartzVideo.m that tries to access NSScreen's private _frame
ivar, which fails to link on 64-bit. See:
https://www.google.com/?q=%22_OBJC_IVAR_%24_NSScreen._frame%22

Attached patch fixes both of these problems.
  • Loading branch information
slouken committed Jan 6, 2012
1 parent 6a9ef50 commit 79d0d58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/cdrom/macosx/AudioFilePlayer.h
Expand Up @@ -37,7 +37,7 @@
#include <AudioUnit/AUNTComponent.h>
#endif

#if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1050)
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1050)
typedef SInt16 FSIORefNum;
#endif

Expand Down
35 changes: 19 additions & 16 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -36,7 +36,18 @@ CG_EXTERN size_t CGDisplayBytesPerRow(CGDirectDisplayID display)
__IPHONE_NA, __IPHONE_NA);
#endif

#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) /* Fixed in Snow Leopard */

static inline BOOL IS_LION_OR_LATER(_THIS)
{
return (system_version >= 0x1070);
}

static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
{
return (system_version >= 0x1060);
}

#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) && !defined(__LP64__) /* 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 All @@ -54,12 +65,14 @@ - (void) setFrame:(NSRect)frame;
_frame = frame;
}
@end
static inline void QZ_SetFrame(NSScreen *nsscreen, NSRect frame)
static inline void QZ_SetFrame(_THIS, NSScreen *nsscreen, NSRect frame)
{
[nsscreen setFrame:frame];
if (!IS_SNOW_LEOPARD_OR_LATER(this)) {
[nsscreen setFrame:frame];
}
}
#else
static inline void QZ_SetFrame(NSScreen *nsscreen, NSRect frame)
static inline void QZ_SetFrame(_THIS, NSScreen *nsscreen, NSRect frame)
{
}
#endif
Expand Down Expand Up @@ -125,16 +138,6 @@ static int QZ_SetColors (_THIS, int first_color,
# endif
#endif

static inline BOOL IS_LION_OR_LATER(_THIS)
{
return (system_version >= 0x1070);
}

static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
{
return (system_version >= 0x1060);
}

static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
{
/* we only own these references in the 10.6+ API. */
Expand Down Expand Up @@ -607,7 +610,7 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop, BOOL save_gl)
See comment in QZ_SetVideoFullscreen for why we do this
*/
screen_rect = NSMakeRect(0,0,device_width,device_height);
QZ_SetFrame([ NSScreen mainScreen ], screen_rect);
QZ_SetFrame(this, [ NSScreen mainScreen ], screen_rect);
}
}
/* Release window mode resources */
Expand Down Expand Up @@ -927,7 +930,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
ourselves. This hack should be removed if/when the bug is fixed.
*/
screen_rect = NSMakeRect(0,0,width,height);
QZ_SetFrame([ NSScreen mainScreen ], screen_rect);
QZ_SetFrame(this, [ NSScreen mainScreen ], screen_rect);

/* Save the flags to ensure correct tear-down */
mode_flags = current->flags;
Expand Down

0 comments on commit 79d0d58

Please sign in to comment.