aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-21 12:32:49 +0200
committerSven Gothel <[email protected]>2011-07-21 12:32:49 +0200
commitc1fb37cdaff46d23717eac402abaea82e2a503f1 (patch)
treee3156dce7b1aa000997bfcb81ec3d26bfe9e717b /src/nativewindow/classes/javax
parentafd46dbeca16a87baba61ae5bfd7767984d66197 (diff)
Use GlueGen Platform's OSType enum
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java47
1 files changed, 21 insertions, 26 deletions
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) {