|
From: <ka...@us...> - 2011-11-12 20:45:41
|
Revision: 3692
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3692&view=rev
Author: kappa1
Date: 2011-11-12 20:45:35 +0000 (Sat, 12 Nov 2011)
Log Message:
-----------
MacOS: further limit CALayer to only be used when running as an Applet
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2011-11-12 19:01:28 UTC (rev 3691)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2011-11-12 20:45:35 UTC (rev 3692)
@@ -32,6 +32,8 @@
package org.lwjgl.opengl;
import java.awt.Canvas;
+import java.awt.Component;
+import java.applet.Applet;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedActionException;
@@ -81,7 +83,7 @@
// due to performance..
// Allow the use of a Core Animation Layer only when using non fullscreen Display.setParent() or AWTGLCanvas
- final boolean allowCALayer = (Display.getParent() != null && !Display.isFullscreen()) || component instanceof AWTGLCanvas;
+ final boolean allowCALayer = ((Display.getParent() != null && !Display.isFullscreen()) || component instanceof AWTGLCanvas) && isApplet(component);
if (firstLockSucceeded)
return lockAndInitHandle(lock_buffer, component, allowCALayer);
@@ -105,4 +107,22 @@
}
private static native void nUnlock(ByteBuffer lock_buffer) throws LWJGLException;
+
+ /**
+ * This method will return true if the component is running in an applet
+ */
+ public boolean isApplet(Canvas component) {
+
+ Component parent = component.getParent();
+
+ while (parent != null) {
+ if (parent instanceof Applet) {
+ return true;
+ }
+ parent = parent.getParent();
+ }
+
+ // not an applet
+ return false;
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java 2011-11-12 19:01:28 UTC (rev 3691)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java 2011-11-12 20:45:35 UTC (rev 3692)
@@ -51,7 +51,7 @@
protected void initHandle(Canvas component) throws LWJGLException {
// Allow the use of a Core Animation Layer only when using non fullscreen Display.setParent() or AWTGLCanvas
- final boolean allowCALayer = (Display.getParent() != null && !Display.isFullscreen()) || component instanceof AWTGLCanvas;
+ final boolean allowCALayer = ((Display.getParent() != null && !Display.isFullscreen()) || component instanceof AWTGLCanvas) && awt_surface.isApplet(component);
nInitHandle(awt_surface.lockAndGetHandle(component), getHandle(), allowCALayer);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|