aboutsummaryrefslogtreecommitdiffstats
path: root/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-06-15 22:57:38 +0000
committerKenneth Russel <[email protected]>2009-06-15 22:57:38 +0000
commita959c53b7ac91e489bf0959391e892790b9ff248 (patch)
tree4664742a4f9f6daa694364292e376ad2e6ee97d1 /make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
parent506b634b780dcd23aa61015c2ceba3e687196abf (diff)
Copied JOGL_2_SANDBOX r1957 on to trunk; JOGL_2_SANDBOX branch is now closed
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1959 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java')
-rwxr-xr-xmake/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java
new file mode 100755
index 000000000..dab377ad4
--- /dev/null
+++ b/make/config/nativewindow/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.nativewindow.impl.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
+ } else if (osName.startsWith("mac os x")) {
+ factoryClass = Class.forName("com.sun.nativewindow.impl.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
+ } else {
+ // Assume Linux, Solaris, etc. Should probably test for these explicitly.
+ factoryClass = Class.forName("com.sun.nativewindow.impl.jawt.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);
+ }
+}