diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java index e6b0bde4..2df4d04e 100644 --- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java +++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java @@ -110,6 +110,8 @@ final class MacOSXDisplay implements DisplayImplementation { private native int nGetWidth(ByteBuffer window_handle); private native int nGetHeight(ByteBuffer window_handle); + + private native boolean nIsNativeMode(ByteBuffer peer_info_handle); private static boolean isUndecorated() { return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); @@ -125,8 +127,6 @@ final class MacOSXDisplay implements DisplayImplementation { close_requested = false; - native_mode = isNativeMode(); - DrawableGL gl_drawable = (DrawableGL)Display.getDrawable(); PeerInfo peer_info = gl_drawable.peer_info; ByteBuffer peer_handle = peer_info.lockAndGetHandle(); @@ -145,6 +145,9 @@ final class MacOSXDisplay implements DisplayImplementation { current_viewport.put(3, mode.getHeight()); } } + + native_mode = nIsNativeMode(peer_handle); + } catch (LWJGLException e) { destroyWindow(); throw e; @@ -152,16 +155,6 @@ final class MacOSXDisplay implements DisplayImplementation { peer_info.unlock(); } } - - private boolean isNativeMode() { - //return true; - - if (Display.isFullscreen() || Display.getParent() == null) { - return true; - } - - return false; - } public void doHandleQuit() { synchronized (this) { diff --git a/src/native/macosx/org_lwjgl_opengl_Display.m b/src/native/macosx/org_lwjgl_opengl_Display.m index 902ddbc9..0bc8b129 100644 --- a/src/native/macosx/org_lwjgl_opengl_Display.m +++ b/src/native/macosx/org_lwjgl_opengl_Display.m @@ -543,6 +543,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyCALayer(JNIEn } } +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsNativeMode(JNIEnv *env, jobject this, jobject peer_info_handle) { + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + if (peer_info->isCALayer) { + return JNI_FALSE; + } + else { + return JNI_TRUE; + } +} + JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion(JNIEnv *env, jobject ignored) { return org_lwjgl_MacOSXSysImplementation_JNI_VERSION; }