diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/config/nativewindow/jawt-CustomJavaCode.java | 35 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java | 2 |
2 files changed, 11 insertions, 26 deletions
diff --git a/make/config/nativewindow/jawt-CustomJavaCode.java b/make/config/nativewindow/jawt-CustomJavaCode.java index d3dc3845f..6ea57dca2 100644 --- a/make/config/nativewindow/jawt-CustomJavaCode.java +++ b/make/config/nativewindow/jawt-CustomJavaCode.java @@ -1,38 +1,23 @@ -/** Available and recommended on Mac OS X >= 10.6 Update 4 */ -public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000; -public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4); - private int jawt_version_cached = 0; public final int getCachedVersion() { return jawt_version_cached; } -/** Helper routine for all users to call to access the JAWT. */ -public static JAWT getJAWT(final int jawt_version_flags) { +protected static boolean getJAWT(final JAWT jawt, 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_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)); + return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + public Boolean run() { + jawt.setVersion(jawt_version_flags); + if (JAWTFactory.JAWT_GetAWT(jawt)) { + jawt.jawt_version_cached = jawt.getVersion(); + return new Boolean(true); } - jawt.jawt_version_cached = jawt.getVersion(); - return jawt; + jawt.jawt_version_cached = 0; + return new Boolean(false); } - }); + }).booleanValue(); } diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java index 4ff3a45b0..092aa5991 100644 --- a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java +++ b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java @@ -13,7 +13,7 @@ private static JAWT_PlatformInfo newPlatformInfo(JAWT jawt, ByteBuffer buf) { 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.getCachedVersion() & JAWT.JAWT_MACOSX_USE_CALAYER ) ) { + if( 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER ) ) { factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_SurfaceLayers"); } else { factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo"); |