Changed the location of the CGDisplayCapture from the GL code to the Display code. A side effect of this is that calling resetDisplayMode() is required - not optional. Not calling resetDisplayMode() may result in a non-responsive machine.

This commit is contained in:
Gregory Pierce 2003-05-10 19:19:12 +00:00
parent 585131c442
commit aa13639386
2 changed files with 11 additions and 9 deletions

View File

@ -142,6 +142,12 @@ jobjectArray GetAvailableDisplayModesOSX(JNIEnv * env)
JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
(JNIEnv * env, jclass clazz)
{
if ( CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess )
{
printf("Unable to capture the display. Without capturing the display - this application cannot run");
return;
}
//Get the current display mode from the system
//
int width = CGDisplayPixelsWide( kCGDirectMainDisplay );
@ -207,6 +213,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode
// the purpose of this method is to return the display mode to whatever it was before
// the application takes over. OSX is smart enough to not require any of this
// foolishness :)
//release the display that we captured so other applications will still work
//
CGReleaseAllDisplays();
}
/*

View File

@ -55,11 +55,6 @@ static CGDirectDisplayID displayID = kCGDirectMainDisplay;
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
(JNIEnv * env, jobject obj, jstring title, jint x, jint y, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil, jboolean fullscreen)
{
if ( CGDisplayCapture( displayID ) != kCGErrorSuccess )
{
return;
}
CGLPixelFormatObj pixelFormatObj;
long numPixelFormats;
@ -102,10 +97,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL
CGLDestroyContext( contextObj );
contextObj = NULL;
}
CGReleaseAllDisplays();
}
}
/*