aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-12 16:15:54 +0100
committerSven Gothel <[email protected]>2011-11-12 16:15:54 +0100
commit8a16d590fe2c739badbabe4906cbe9d60b20e2b9 (patch)
tree57d7c0794437d2025aae7c29b340af952b5043bb /make
parent33aaa037e31ec7d411f4acaeea63a383037f027d (diff)
OS X Layered View Part8: Generalize OffscreenLayerSurface ; Use local JAWT instance ; Applet's on OS X are working
Generalize OffscreenLayerSurface - Using new OffscreenLayerSurface allows using this functionality in a clean manner, ie. no 'dirty' usage of MacOSXJAWTWindow in a JOGL GL class. - 'Promoting' OffscreenLayerSurface functionality to JAWTWindow and it's handling to GLDrawableFactoryImpl::createGLDrawable(). - Move MacOSXCGLDrawableFactory's "MacOSXJAWTWindow getLayeredSurfaceHost(NativeSurface surface)" to NativeWindowFactory "OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled)" Use local JAWT instance - Only w/ a local JAWT instance per JAWTWindow it is possible to switch between offscreen-layer and onscreen. We also have to determing offscreen-layer lazy at surface lock, since only at that time we have knowledge whether it's an Applet or not. +++ ContextUpdater: Use local pthread mutex, add DEBUG output JAWTWindow/NewtCanvasAWT: Adding methods to request offscreen-layer-surface (if supported), besides 'if applet' this may trigger the new functionality. +++ Applet's on OS X are working: - OS X 10.6.4 - Safari: - Hangs for a while at start .. whole screen freezes .. approx. 10s - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input isn't assigned sometimes. - Otherwise .. works well, incl. offscreen/onscreen parenting - Firefox 8.0: - Hangs for a while at start .. whole screen freezes .. approx. 10s - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input is never assigned. - Otherwise .. works well, incl. offscreen/onscreen parenting - OS X 10.7 - Safari: - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input isn't assigned sometimes. - Otherwise .. works well, incl. offscreen/onscreen parenting - Firefox 8.0: - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input is never assigned. - Otherwise .. works well, incl. offscreen/onscreen parenting
Diffstat (limited to 'make')
-rw-r--r--make/config/nativewindow/jawt-CustomJavaCode.java78
-rw-r--r--make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java8
2 files changed, 30 insertions, 56 deletions
diff --git a/make/config/nativewindow/jawt-CustomJavaCode.java b/make/config/nativewindow/jawt-CustomJavaCode.java
index 090dcb31f..d3dc3845f 100644
--- a/make/config/nativewindow/jawt-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-CustomJavaCode.java
@@ -2,63 +2,37 @@
public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000;
public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4);
-private static volatile JAWT jawt = null;
-private static int jawt_version_flags = 0;
-
private int jawt_version_cached = 0;
-public final int getVersionCached() {
+public final int getCachedVersion() {
return jawt_version_cached;
}
-public static void setJAWTVersionFlags(int versionFlags) {
- synchronized (JAWT.class) {
- if (jawt != null) {
- throw new RuntimeException("JAWT already instantiated");
- }
- jawt_version_flags = 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) {
- synchronized (JAWT.class) {
- if (jawt == null) {
- JAWTUtil.initSingleton();
- // Workaround for 4845371.
- // Make sure the first reference to the JNI GetDirectBufferAddress is done
- // from a privileged context so the VM's internal class lookups will succeed.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- JAWT j = JAWT.create();
- if( 0 != ( jawt_version_flags & JAWT_MACOSX_USE_CALAYER ) ) {
- j.setVersion(jawt_version_flags);
- if (JAWTFactory.JAWT_GetAWT(j)) {
- jawt = j;
- jawt.jawt_version_cached = jawt.getVersion();
- return null;
- }
- jawt_version_flags &= ~JAWT_MACOSX_USE_CALAYER;
- System.err.println("MacOSX "+Platform.OS_VERSION_NUMBER+" >= "+JAWT_MacOSXCALayerMinVersion+": Failed to use JAWT_MACOSX_USE_CALAYER");
- }
- j.setVersion(jawt_version_flags);
- if (!JAWTFactory.JAWT_GetAWT(j)) {
- throw new RuntimeException("Unable to initialize JAWT: 0x"+Integer.toHexString(jawt_version_flags));
+public static JAWT getJAWT(final int jawt_version_flags) {
+ JAWTUtil.initSingleton();
+ // Workaround for 4845371.
+ // Make sure the first reference to the JNI GetDirectBufferAddress is done
+ // from a privileged context so the VM's internal class lookups will succeed.
+ return AccessController.doPrivileged(new PrivilegedAction<JAWT>() {
+ public JAWT run() {
+ int jawt_version_flags_mod = jawt_version_flags;
+ JAWT jawt = JAWT.create();
+ if( 0 != ( jawt_version_flags_mod & JAWT_MACOSX_USE_CALAYER ) ) {
+ jawt.setVersion(jawt_version_flags_mod);
+ if (JAWTFactory.JAWT_GetAWT(jawt)) {
+ jawt.jawt_version_cached = jawt.getVersion();
+ return jawt;
}
- jawt = j;
- jawt.jawt_version_cached = jawt.getVersion();
- return null;
- }
- });
- }
- }
- }
- return jawt;
+ jawt_version_flags_mod &= ~JAWT_MACOSX_USE_CALAYER;
+ System.err.println("MacOSX "+Platform.OS_VERSION_NUMBER+" >= "+JAWT_MacOSXCALayerMinVersion+": Failed to use JAWT_MACOSX_USE_CALAYER");
+ }
+ jawt.setVersion(jawt_version_flags_mod);
+ if (!JAWTFactory.JAWT_GetAWT(jawt)) {
+ throw new RuntimeException("Unable to initialize JAWT: 0x"+Integer.toHexString(jawt_version_flags_mod));
+ }
+ jawt.jawt_version_cached = jawt.getVersion();
+ return jawt;
+ }
+ });
}
diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
index cab6c93d4..4ff3a45b0 100644
--- a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
+++ b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
@@ -1,19 +1,19 @@
-public JAWT_PlatformInfo platformInfo() {
- return newPlatformInfo(platformInfo0(getBuffer()));
+public JAWT_PlatformInfo platformInfo(final JAWT jawt) {
+ return newPlatformInfo(jawt, platformInfo0(getBuffer()));
}
private native ByteBuffer platformInfo0(Buffer jthis0);
private static java.lang.reflect.Method platformInfoFactoryMethod;
-private static JAWT_PlatformInfo newPlatformInfo(ByteBuffer buf) {
+private static JAWT_PlatformInfo newPlatformInfo(JAWT jawt, ByteBuffer buf) {
if (platformInfoFactoryMethod == null) {
try {
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 ) ) {
+ if( 0 != ( jawt.getCachedVersion() & JAWT.JAWT_MACOSX_USE_CALAYER ) ) {
factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_SurfaceLayers");
} else {
factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");