now osx code builds successfully with both 10.5 and 10.6 SDK

This commit is contained in:
xant
2010-04-17 15:18:43 +02:00
parent 33adb92eff
commit a58c014f88
3 changed files with 26 additions and 10 deletions

View File

@@ -65,7 +65,7 @@
options:nil] retain];
#else
// deprecated in 10.6
ciContext = [[CIContext contextWithCGLContext:(CGLContextObj)[currentContext CGLContextObj]
ciContext = [[CIContext contextWithCGLContext:(CGLContextObj)[[self openGLContext] CGLContextObj]
pixelFormat:(CGLPixelFormatObj)[[self pixelFormat] CGLPixelFormatObj]
options:[NSDictionary dictionaryWithObjectsAndKeys:
(id)colorSpace,kCIContextOutputColorSpace,

View File

@@ -50,7 +50,11 @@ class CVScreen;
CIImage *lastFrame;
NSTimer *renderTimer;
bool fullScreen;
CGDisplayModeRef savedMode;
#if MAC_OS_X_VERSION_10_6
CGDisplayModeRef savedMode;
#else
CFDictionaryRef savedMode;
#endif
bool needsReshape;
FrameRate *rateCalc;
CGContextRef exportCGContextRef;

View File

@@ -568,8 +568,11 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
CGDirectDisplayID currentDisplayID = (CGDirectDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
CGDisplayErr err;
if (fullScreen) {
//CGDisplaySwitchToMode(currentDisplayId savedMode);
#if MAC_OS_X_VERSION_10_6
err = CGDisplaySetDisplayMode(currentDisplayID, savedMode, NULL);
#else
CGDisplaySwitchToMode(currentDisplayID, savedMode);
#endif
if ( err != CGDisplayNoErr ) {
// TODO -e rror messages
}
@@ -584,7 +587,7 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
fullScreen = NO;
needsReshape = YES;
} else {
//CFDictionaryRef newMode = CGDisplayBestModeForParameters(currentDisplayID, 32, fjScreen->geo.w, fjScreen->geo.h, 0);
#if MAC_OS_X_VERSION_10_6
CGDisplayModeRef newMode;
bool exactMatch;
// Loop through all display modes to determine the closest match.
@@ -624,20 +627,29 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
}
}
}
//CFDictionaryRef newMode = CGDisplayBestModeForParameters(currentDisplayID, 32, fjScreen->geo.w, fjScreen->geo.h, 0);
NSAssert(newMode, @"Couldn't find display mode");
myWindow = [[self window] retain];
/*
#else
CFDictionaryRef newMode = CGDisplayBestModeForParameters(currentDisplayID, 32, fjScreen->geo.w, fjScreen->geo.h, 0);
savedMode = CGDisplayCurrentMode(currentDisplayID);
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
CGDisplaySwitchToMode(currentDisplayID, newMode);
*/
#endif
NSAssert(newMode, @"Couldn't find display mode");
myWindow = [[self window] retain];
#if MAC_OS_X_VERSION_10_6
savedMode = CGDisplayCopyDisplayMode(currentDisplayID);
#else
savedMode = CGDisplayCurrentMode(currentDisplayID);
#endif
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
//CGDisplaySwitchToMode(currentDisplayID, newMode);
#if MAC_OS_X_VERSION_10_6
err = CGDisplaySetDisplayMode(currentDisplayID, newMode, NULL);
#else
CGDisplaySwitchToMode(currentDisplayID, newMode);
#endif
if ( err != CGDisplayNoErr ) {
// TODO -e rror messages
}