Tweak CALayer mode to active correctly

This commit is contained in:
kappaOne 2013-01-15 23:09:03 +00:00
parent 02c0e80fb6
commit fc9e4f4bda
2 changed files with 15 additions and 12 deletions

View File

@ -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) {

View File

@ -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;
}