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:
parent
585131c442
commit
aa13639386
|
@ -142,6 +142,12 @@ jobjectArray GetAvailableDisplayModesOSX(JNIEnv * env)
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
|
JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
|
||||||
(JNIEnv * env, jclass clazz)
|
(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
|
//Get the current display mode from the system
|
||||||
//
|
//
|
||||||
int width = CGDisplayPixelsWide( kCGDirectMainDisplay );
|
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 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
|
// the application takes over. OSX is smart enough to not require any of this
|
||||||
// foolishness :)
|
// foolishness :)
|
||||||
|
|
||||||
|
//release the display that we captured so other applications will still work
|
||||||
|
//
|
||||||
|
CGReleaseAllDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -55,11 +55,6 @@ static CGDirectDisplayID displayID = kCGDirectMainDisplay;
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
|
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)
|
(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;
|
CGLPixelFormatObj pixelFormatObj;
|
||||||
long numPixelFormats;
|
long numPixelFormats;
|
||||||
|
|
||||||
|
@ -103,9 +98,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL
|
||||||
|
|
||||||
contextObj = NULL;
|
contextObj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CGReleaseAllDisplays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue