diff options
Diffstat (limited to 'make')
-rwxr-xr-x | make/jawt-DrawingSurfaceInfo-CustomJavaCode.java | 38 | ||||
-rw-r--r-- | make/jawt-macosx.cfg | 5 | ||||
-rw-r--r-- | make/jawt-win32.cfg | 5 | ||||
-rw-r--r-- | make/jawt-x11.cfg | 5 |
4 files changed, 41 insertions, 12 deletions
diff --git a/make/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/jawt-DrawingSurfaceInfo-CustomJavaCode.java new file mode 100755 index 000000000..2e9bd37b6 --- /dev/null +++ b/make/jawt-DrawingSurfaceInfo-CustomJavaCode.java @@ -0,0 +1,38 @@ +public JAWT_PlatformInfo platformInfo() { + return newPlatformInfo(platformInfo0(getBuffer())); +} + +private native ByteBuffer platformInfo0(Buffer jthis0); + +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("com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo"); + } else if (osName.startsWith("mac os x")) { + factoryClass = Class.forName("com.sun.opengl.impl.macosx.JAWT_MacOSXDrawingSurfaceInfo"); + } else { + // Assume Linux, Solaris, etc. Should probably test for these explicitly. + factoryClass = Class.forName("com.sun.opengl.impl.x11.JAWT_X11DrawingSurfaceInfo"); + } + platformInfoFactoryMethod = factoryClass.getMethod("create", + new Class[] { ByteBuffer.class }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + try { + return (JAWT_PlatformInfo) + platformInfoFactoryMethod.invoke(null, new Object[] { buf }); + } catch (Exception e) { + throw new RuntimeException(e); + } +} diff --git a/make/jawt-macosx.cfg b/make/jawt-macosx.cfg index a7886a250..1dd4d297e 100644 --- a/make/jawt-macosx.cfg +++ b/make/jawt-macosx.cfg @@ -27,7 +27,4 @@ StructPackage JAWT_MacOSXDrawingSurfaceInfo com.sun.opengl.impl.macosx EmitStruct JAWT_MacOSXDrawingSurfaceInfo Implements JAWT_MacOSXDrawingSurfaceInfo JAWT_PlatformInfo -CustomJavaCode JAWT_DrawingSurfaceInfo public JAWT_PlatformInfo platformInfo() { -CustomJavaCode JAWT_DrawingSurfaceInfo return platformInfo0(getBuffer()); -CustomJavaCode JAWT_DrawingSurfaceInfo } -CustomJavaCode JAWT_DrawingSurfaceInfo private native JAWT_PlatformInfo platformInfo0(Buffer jthis0); +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java diff --git a/make/jawt-win32.cfg b/make/jawt-win32.cfg index 7f9d74e7b..15a642f10 100644 --- a/make/jawt-win32.cfg +++ b/make/jawt-win32.cfg @@ -30,7 +30,4 @@ StructPackage JAWT_Win32DrawingSurfaceInfo com.sun.opengl.impl.windows EmitStruct JAWT_Win32DrawingSurfaceInfo Implements JAWT_Win32DrawingSurfaceInfo JAWT_PlatformInfo -CustomJavaCode JAWT_DrawingSurfaceInfo public JAWT_PlatformInfo platformInfo() { -CustomJavaCode JAWT_DrawingSurfaceInfo return platformInfo0(getBuffer()); -CustomJavaCode JAWT_DrawingSurfaceInfo } -CustomJavaCode JAWT_DrawingSurfaceInfo private native JAWT_PlatformInfo platformInfo0(Buffer jthis0); +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java diff --git a/make/jawt-x11.cfg b/make/jawt-x11.cfg index 43ccef7ec..40ac88b50 100644 --- a/make/jawt-x11.cfg +++ b/make/jawt-x11.cfg @@ -27,7 +27,4 @@ StructPackage JAWT_X11DrawingSurfaceInfo com.sun.opengl.impl.x11 EmitStruct JAWT_X11DrawingSurfaceInfo Implements JAWT_X11DrawingSurfaceInfo JAWT_PlatformInfo -CustomJavaCode JAWT_DrawingSurfaceInfo public JAWT_PlatformInfo platformInfo() { -CustomJavaCode JAWT_DrawingSurfaceInfo return platformInfo0(getBuffer()); -CustomJavaCode JAWT_DrawingSurfaceInfo } -CustomJavaCode JAWT_DrawingSurfaceInfo private native JAWT_PlatformInfo platformInfo0(Buffer jthis0); +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java |