diff --git a/src/native/macosx/org_lwjgl_Display.cpp b/src/native/macosx/org_lwjgl_Display.cpp index dc9b99be..dae2457c 100644 --- a/src/native/macosx/org_lwjgl_Display.cpp +++ b/src/native/macosx/org_lwjgl_Display.cpp @@ -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(); } /* diff --git a/src/native/macosx/org_lwjgl_opengl_BaseGL.cpp b/src/native/macosx/org_lwjgl_opengl_BaseGL.cpp index 12a66e73..f4342051 100644 --- a/src/native/macosx/org_lwjgl_opengl_BaseGL.cpp +++ b/src/native/macosx/org_lwjgl_opengl_BaseGL.cpp @@ -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(); + } } /*