diff options
author | Sven Gothel <[email protected]> | 2011-07-21 12:32:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-21 12:32:49 +0200 |
commit | c1fb37cdaff46d23717eac402abaea82e2a503f1 (patch) | |
tree | e3156dce7b1aa000997bfcb81ec3d26bfe9e717b /src | |
parent | afd46dbeca16a87baba61ae5bfd7767984d66197 (diff) |
Use GlueGen Platform's OSType enum
Diffstat (limited to 'src')
6 files changed, 31 insertions, 31 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index 530e6fe76..a096934d0 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -52,6 +52,7 @@ import com.jogamp.gluegen.cgram.types.FunctionSymbol; import com.jogamp.gluegen.procaddress.ProcAddressEmitter; import com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter; import com.jogamp.gluegen.runtime.opengl.GLExtensionNames; + import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java index 4d8c14985..87d870817 100755 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -45,6 +45,7 @@ import com.jogamp.gluegen.JavaMethodBindingEmitter; import com.jogamp.gluegen.MethodBinding; import com.jogamp.gluegen.cgram.types.Type; import com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter; + import java.io.PrintWriter; /** A specialization of the proc address emitter which knows how to diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java index e8cdcc4b4..bfaf7ac89 100755 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java @@ -46,6 +46,7 @@ import com.jogamp.gluegen.MethodBinding; import com.jogamp.gluegen.cgram.types.FunctionSymbol; import com.jogamp.gluegen.opengl.GLEmitter; import com.jogamp.gluegen.opengl.GLJavaMethodBindingEmitter; + import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java index c0c66a4b3..b4cab2885 100755 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java @@ -47,6 +47,7 @@ import com.jogamp.gluegen.cgram.types.Type; import com.jogamp.gluegen.opengl.GLEmitter; import com.jogamp.gluegen.opengl.GLJavaMethodBindingEmitter; import com.jogamp.gluegen.procaddress.ProcAddressJavaMethodBindingEmitter; + import java.io.PrintWriter; public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBindingEmitter { diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 64781e418..3b71555b4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -38,6 +38,8 @@ import java.util.*; import com.jogamp.common.util.*; import com.jogamp.common.jvm.JVMUtil; +import com.jogamp.common.os.Platform; + import jogamp.nativewindow.*; import java.lang.reflect.Constructor; import java.lang.reflect.Method; @@ -73,9 +75,7 @@ public abstract class NativeWindowFactory { private static Map/*<Class, NativeWindowFactory>*/ registeredFactories; private static Class nativeWindowClass; private static String nativeWindowingTypePure; - private static String nativeOSNamePure; private static String nativeWindowingTypeCustom; - private static String nativeOSNameCustom; private static boolean isAWTAvailable; public static final String AWTComponentClassName = "java.awt.Component" ; public static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ; @@ -98,17 +98,22 @@ public abstract class NativeWindowFactory { protected NativeWindowFactory() { } - private static String _getNativeWindowingType(String osNameLowerCase) { - if (osNameLowerCase.startsWith("kd")) { - return TYPE_EGL; - } else if (osNameLowerCase.startsWith("wind")) { - return TYPE_WINDOWS; - } else if (osNameLowerCase.startsWith("mac os x") || - osNameLowerCase.startsWith("darwin")) { + private static String _getNativeWindowingType() { + switch(Platform.OS_TYPE) { + case ANDROID: + throw new RuntimeException(Platform.OS_TYPE+" n/a yet"); + case MACOS: return TYPE_MACOSX; - } else if (osNameLowerCase.equals("awt")) { - return TYPE_AWT; - } else { + case WINDOWS: + return TYPE_WINDOWS; + case OPENKODE: + return TYPE_EGL; + + case LINUX: + case FREEBSD: + case SUNOS: + case HPUX: + default: return TYPE_X11; } } @@ -170,14 +175,12 @@ public abstract class NativeWindowFactory { // Gather the windowing OS first AccessControlContext acc = AccessController.getContext(); - nativeOSNamePure = Debug.getProperty("os.name", false, acc); - nativeWindowingTypePure = _getNativeWindowingType(nativeOSNamePure.toLowerCase()); - nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true, acc); - if(null==nativeOSNameCustom||nativeOSNameCustom.length()==0) { - nativeOSNameCustom = nativeOSNamePure; + nativeWindowingTypePure = _getNativeWindowingType(); + String tmp = Debug.getProperty("nativewindow.ws.name", true, acc); + if(null==tmp || tmp.length()==0) { nativeWindowingTypeCustom = nativeWindowingTypePure; } else { - nativeWindowingTypeCustom = nativeOSNameCustom; + nativeWindowingTypeCustom = tmp; } final ClassLoader cl = NativeWindowFactory.class.getClassLoader(); @@ -268,14 +271,6 @@ public abstract class NativeWindowFactory { /** * @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value. - * @return the native OS name - */ - public static String getNativeOSName(boolean useCustom) { - return useCustom?nativeOSNameCustom:nativeOSNamePure; - } - - /** - * @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value. * @return a define native window type, like {@link #TYPE_X11}, .. */ public static String getNativeWindowType(boolean useCustom) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index 3db8f32d2..e3322ac45 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -32,6 +32,7 @@ package jogamp.nativewindow; +import com.jogamp.common.os.Platform; import com.jogamp.common.util.*; import java.lang.reflect.*; @@ -73,21 +74,21 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) { if (nativeWindowConstructor == null) { try { - String osType = getNativeWindowType(true); + String windowingType = getNativeWindowType(true); String windowClassName = null; // We break compile-time dependencies on the AWT here to // make it easier to run this code on mobile devices - if (osType.equals(TYPE_WINDOWS)) { + if (windowingType.equals(TYPE_WINDOWS)) { windowClassName = "jogamp.nativewindow.jawt.windows.WindowsJAWTWindow"; - } else if (osType.equals(TYPE_MACOSX)) { + } else if (windowingType.equals(TYPE_MACOSX)) { windowClassName = "jogamp.nativewindow.jawt.macosx.MacOSXJAWTWindow"; - } else if (osType.equals(TYPE_X11)) { + } else if (windowingType.equals(TYPE_X11)) { // Assume Linux, Solaris, etc. Should probably test for these explicitly. windowClassName = "jogamp.nativewindow.jawt.x11.X11JAWTWindow"; } else { - throw new IllegalArgumentException("OS " + getNativeOSName(false) + " not yet supported"); + throw new IllegalArgumentException("OS " + Platform.getOS() + " not yet supported"); } nativeWindowConstructor = ReflectionUtil.getConstructor( |