diff options
Diffstat (limited to 'make/config/nativewindow')
-rw-r--r-- | make/config/nativewindow/jawt-CustomJavaCode.java | 6 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java | 31 |
2 files changed, 21 insertions, 16 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); } |