aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/config/nativewindow/jawt-CustomJavaCode.java6
-rw-r--r--make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java31
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableImpl.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java6
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java9
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java40
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java2
9 files changed, 73 insertions, 39 deletions
diff --git a/make/config/nativewindow/jawt-CustomJavaCode.java b/make/config/nativewindow/jawt-CustomJavaCode.java
index 23da6b3b9..090dcb31f 100644
--- a/make/config/nativewindow/jawt-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-CustomJavaCode.java
@@ -20,6 +20,12 @@ public static void setJAWTVersionFlags(int versionFlags) {
}
}
+public static boolean isJAWTInstantiated() {
+ synchronized (JAWT.class) {
+ return jawt != null;
+ }
+}
+
/** Helper routine for all users to call to access the JAWT. */
public static JAWT getJAWT() {
if (jawt == null) {
diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
index 598ced346..cab6c93d4 100644
--- a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
@@ -8,23 +8,22 @@ private static java.lang.reflect.Method platformInfoFactoryMethod;
private static JAWT_PlatformInfo newPlatformInfo(ByteBuffer buf) {
if (platformInfoFactoryMethod == null) {
- String osName = (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty("os.name").toLowerCase();
- }
- });
try {
- Class factoryClass;
- if (osName.startsWith("wind")) {
- factoryClass = Class.forName("jogamp.nativewindow.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
- } else if (osName.startsWith("mac os x")) {
- factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
- } else {
- // Assume Linux, Solaris, etc. Should probably test for these explicitly.
- factoryClass = Class.forName("jogamp.nativewindow.jawt.x11.JAWT_X11DrawingSurfaceInfo");
- }
- platformInfoFactoryMethod = factoryClass.getMethod("create",
- new Class[] { ByteBuffer.class });
+ Class<?> factoryClass;
+ if (Platform.OS_TYPE == Platform.OSType.WINDOWS) {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
+ } else if (Platform.OS_TYPE == Platform.OSType.MACOS) {
+ if( 0 != ( JAWT.getJAWT().getVersionCached() & JAWT.JAWT_MACOSX_USE_CALAYER ) ) {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_SurfaceLayers");
+ } else {
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
+ }
+ } else {
+ // Assume Linux, Solaris, etc. Should probably test for these explicitly.
+ factoryClass = Class.forName("jogamp.nativewindow.jawt.x11.JAWT_X11DrawingSurfaceInfo");
+ }
+ platformInfoFactoryMethod = factoryClass.getMethod("create",
+ new Class[] { ByteBuffer.class });
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 58c9aaaa6..6b6ce9f9e 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -125,7 +125,10 @@ public abstract class GLDrawableImpl implements GLDrawable {
return surface;
}
+ /** called with locked surface @ setRealized(false) */
protected void destroyHandle() {}
+
+ /** called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed */
protected void updateHandle() {}
public long getHandle() {
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index 318d00637..1f8ba5cc4 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -146,6 +146,17 @@ public class GLGraphicsConfigurationUtil {
return capsRequested;
}
+ public static GLCapabilitiesImmutable fixSingleBufferGLCapabilities(GLCapabilitiesImmutable capsRequested)
+ {
+ if( capsRequested.getDoubleBuffered() ) {
+ // fix caps ..
+ GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
+ caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+ return caps2;
+ }
+ return capsRequested;
+ }
+
public static GLCapabilitiesImmutable fixOpaqueGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean isOpaque)
{
GLCapabilities caps2 = null;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index 8ef642322..8cea2a550 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -56,14 +56,16 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
}
@SuppressWarnings("unused")
+ @Override
public long getHandle() {
if(USE_GLXWINDOW && useGLXWindow) {
return glXWindow;
}
- return getNativeSurface().getSurfaceHandle();
+ return super.getHandle();
}
@SuppressWarnings("unused")
+ @Override
protected void destroyHandle() {
if(USE_GLXWINDOW && 0!=glXWindow) {
GLX.glXDestroyWindow(getNativeSurface().getDisplayHandle(), glXWindow);
@@ -72,7 +74,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
}
}
- /** must be locked already */
+ @Override
protected void updateHandle() {
if(USE_GLXWINDOW) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index afcc3cbf0..a88ca678e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -77,14 +77,17 @@ public class JAWTUtil {
boolean ok;
}
- public static void setJAWTVersionFlags(boolean useOffScreenLayerIfAvailable) {
+ public static boolean setJAWTVersionFlags(boolean useOffScreenLayerIfAvailable) {
+ if(JAWT.isJAWTInstantiated()) { return false; } // already instantiated
+
if(useOffScreenLayerIfAvailable &&
Platform.OS_TYPE == Platform.OSType.MACOS &&
Platform.OS_VERSION_NUMBER.compareTo(JAWT.JAWT_MacOSXCALayerMinVersion) >= 0) {
JAWT.setJAWTVersionFlags(JAWTFactory.JAWT_VERSION_1_4 | JAWT.JAWT_MACOSX_USE_CALAYER);
- } else {
- JAWT.setJAWTVersionFlags(JAWTFactory.JAWT_VERSION_1_4);
+ return true;
}
+ JAWT.setJAWTVersionFlags(JAWTFactory.JAWT_VERSION_1_4);
+ return !useOffScreenLayerIfAvailable; // n/a
}
public static boolean isJAWTVersionUsingOffscreenLayer() {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index cc6493313..be47e8939 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -42,6 +42,7 @@ import com.jogamp.common.util.locks.RecursiveLock;
import java.awt.Component;
import java.awt.Window;
+import java.applet.Applet;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
@@ -58,6 +59,7 @@ public abstract class JAWTWindow implements NativeWindow {
// lifetime: forever
protected Component component;
+ protected boolean isApplet;
protected AbstractGraphicsConfiguration config;
// lifetime: valid after lock, forever until invalidate
@@ -75,15 +77,27 @@ public abstract class JAWTWindow implements NativeWindow {
private void init(Component windowObject) throws NativeWindowException {
invalidate();
this.component = windowObject;
+ this.isApplet = false;
+ while(!isApplet && null != windowObject) {
+ isApplet = windowObject instanceof Applet;
+ windowObject = windowObject.getParent();
+ }
+ if(isApplet) {
+ JAWTUtil.setJAWTVersionFlags(true); // useOffScreenLayerIfAvailable := true
+ } else {
+ // test
+ JAWTUtil.setJAWTVersionFlags(true); // useOffScreenLayerIfAvailable := true
+ }
validateNative();
}
protected abstract void validateNative() throws NativeWindowException;
protected synchronized void invalidate() {
- component = null;
+ invalidateNative();
drawable= 0;
bounds = new Rectangle();
}
+ protected abstract void invalidateNative();
protected final void updateBounds(JAWT_Rectangle jawtBounds) {
bounds.setX(jawtBounds.getX());
@@ -100,12 +114,16 @@ public abstract class JAWTWindow implements NativeWindow {
public final Component getAWTComponent() {
return component;
}
+
+ public final boolean isApplet() {
+ return isApplet;
+ }
//
// SurfaceUpdateListener
//
- public final void surfaceUpdated(Object updater, NativeSurface ns, long when) {
+ public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
// nop
}
@@ -169,15 +187,14 @@ public abstract class JAWTWindow implements NativeWindow {
return surfaceLock.getOwner();
}
- public final boolean surfaceSwap() {
+ public boolean surfaceSwap() {
return false;
}
- public final void surfaceUpdated(Object updater, NativeWindow window, long when) { }
-
- public final long getSurfaceHandle() {
+ public long getSurfaceHandle() {
return drawable;
}
+
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config;
}
@@ -207,12 +224,13 @@ public abstract class JAWTWindow implements NativeWindow {
//
public synchronized void destroy() {
+ invalidate();
if(null!=component) {
if(component instanceof Window) {
((Window)component).dispose();
}
+ component = null;
}
- invalidate();
}
public final NativeWindow getParent() {
@@ -223,14 +241,6 @@ public abstract class JAWTWindow implements NativeWindow {
return drawable;
}
- public boolean isSetWindowHandleSupported() {
- return false;
- }
- public void setWindowHandle(long handle) {
- throw new java.lang.UnsupportedOperationException();
- }
-
-
public final int getX() {
return component.getX();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
index 982b94888..610ce0f15 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
@@ -61,9 +61,7 @@ public class WindowsJAWTWindow extends JAWTWindow {
protected void validateNative() throws NativeWindowException {
}
- @Override
- protected synchronized void invalidate() {
- super.invalidate();
+ protected void invalidateNative() {
windowHandle = 0;
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
index 2319d6269..562a9339a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
@@ -85,6 +85,8 @@ public class X11JAWTWindow extends JAWTWindow {
}
awtDevice.setSubType(NativeWindowFactory.TYPE_X11, displayHandle);
}
+
+ protected void invalidateNative() { }
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;