Navigation Menu

Skip to content

Commit

Permalink
Try to include more Lion-specific code, even when building with the 1…
Browse files Browse the repository at this point in the history
…0.4u SDK.
  • Loading branch information
icculus committed Sep 14, 2011
1 parent 4696c4d commit 4e5b930
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -24,7 +24,7 @@
#include "SDL_QuartzVideo.h"
#include "SDL_QuartzWindow.h"

#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 /* Fixed in Snow Leopard */
#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 @@ -106,15 +106,6 @@ static int QZ_SetColors (_THIS, int first_color,
"Quartz", "Mac OS X CoreGraphics", QZ_Available, QZ_CreateDevice
};


/* !!! FIXME: clean out pre-10.6 code when (if!) it makes sense to do so. */
#define FORCE_OLD_API 0 || (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)

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

/* Disable compiler warnings we can't avoid. */
#if (defined(__GNUC__) && (__GNUC__ >= 4))
# if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1070)
Expand All @@ -124,20 +115,12 @@ static int QZ_SetColors (_THIS, int first_color,

static inline BOOL IS_LION_OR_LATER(_THIS)
{
#if FORCE_OLD_API
return NO;
#else
return (system_version >= 0x1070);
#endif
}

static inline BOOL IS_SNOW_LEOPARD_OR_LATER(_THIS)
{
#if FORCE_OLD_API
return NO;
#else
return (system_version >= 0x1060);
#endif
}

static void QZ_ReleaseDisplayMode(_THIS, const void *moderef)
Expand Down Expand Up @@ -784,11 +767,9 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
if (qz_window != nil) {
[ qz_window setAcceptsMouseMovedEvents:YES ];
[ qz_window setViewsNeedDisplay:NO ];
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
if (isLion) {
[ qz_window setContentView: [ [ [ SDL_QuartzView alloc ] init ] autorelease ] ];
}
#endif
}
}
/* We already have a window, just change its size */
Expand All @@ -812,22 +793,18 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
view allow the cursor to be changed whilst in fullscreen.*/
window_view = [ [ NSView alloc ] initWithFrame:contentRect ];

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
if ( isLion ) {
[ window_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];
}
#endif

[ [ qz_window contentView ] addSubview:window_view ];

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
if ( isLion ) {
[ qz_window setLevel:CGShieldingWindowLevel() ];
[ gl_context setView: window_view ];
[ gl_context setFullScreen ];
[ gl_context update ];
}
#endif

#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
if ( !isLion) {
Expand All @@ -851,7 +828,6 @@ other blitting while waiting on the VBL (and hence results in higher framerates)

current->flags |= SDL_OPENGL;
} else if (isLion) { /* For 2D, we build a CGBitmapContext */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
CGColorSpaceRef cgColorspace;

/* Only recreate the view if it doesn't already exist */
Expand Down Expand Up @@ -881,16 +857,13 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
this->UpdateRects = QZ_UpdateRects;
this->LockHWSurface = QZ_LockHWSurface;
this->UnlockHWSurface = QZ_UnlockHWSurface;
#endif
}

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
if (isLion) {
[ qz_window setHasShadow:NO];
[ qz_window setOpaque:YES];
[ qz_window makeKeyAndOrderFront:nil ];
}
#endif

/* If we don't hide menu bar, it will get events and interrupt the program */
HideMenuBar ();
Expand Down

0 comments on commit 4e5b930

Please sign in to comment.