diff options
author | Sven Gothel <[email protected]> | 2012-09-20 23:18:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-20 23:18:30 +0200 |
commit | 48f033d61dcf6c6d6964457710f6ac273ef4fc58 (patch) | |
tree | 37f0cef560a83b28adb8b9105715a3144a373bc7 | |
parent | 923d9dd7f1d40db72d35ca76a761ca14babf147f (diff) |
NativeWindowFactory/NEWT: Use relative sub-package names in NativeWindowFactory's TYPE_* strings, not NEWT's; NEWTFactory: Use default NEWT package name if rel. 'path'.
Use relative sub-package names in NativeWindowFactory's TYPE_* strings, not NEWT's
Otherwise NEWT depends solely on NativeWindowFactory strings
- Default subpackages denominate a relative path, i.e. start with a dot: '.egl', '.windows', '.x11'
- Custom name may be absolute, eg: 'my.company.special.drivers.chip4'
NEWTFactory: Use default NEWT package name if relative 'path'.
- If NativeWindowFactory type starts w/ dot (rel. path), simply prepend the default NEWT package prefix
otherwise use complete package name as-is.
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java | 14 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/NewtFactory.java | 9 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 89d476a3b..40aaa8a25 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -57,25 +57,25 @@ public abstract class NativeWindowFactory { protected static final boolean DEBUG; /** OpenKODE/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ - public static final String TYPE_EGL = "jogamp.newt.driver.kd".intern(); + public static final String TYPE_EGL = ".egl".intern(); /** Microsoft Windows type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_WINDOWS = "jogamp.newt.driver.windows".intern(); + public static final String TYPE_WINDOWS = ".windows".intern(); /** X11 type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_X11 = "jogamp.newt.driver.x11".intern(); + public static final String TYPE_X11 = ".x11".intern(); /** Android/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ - public static final String TYPE_ANDROID = "jogamp.newt.driver.android".intern(); + public static final String TYPE_ANDROID = ".android".intern(); /** Mac OS X type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_MACOSX = "jogamp.newt.driver.macosx".intern(); + public static final String TYPE_MACOSX = ".macosx".intern(); /** Generic AWT type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_AWT = "jogamp.newt.driver.awt".intern(); + public static final String TYPE_AWT = ".awt".intern(); /** Generic DEFAULT type, where platform implementation don't care, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_DEFAULT = "default".intern(); + public static final String TYPE_DEFAULT = ".default".intern(); private static final String nativeWindowingTypePure; // canonical String via String.intern() private static final String nativeWindowingTypeCustom; // canonical String via String.intern() diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 0644c9164..abae94ab6 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -49,6 +49,8 @@ import jogamp.newt.WindowImpl; public class NewtFactory { public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window"); + public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver"; + // Work-around for initialization order problems on Mac OS X // between native Newt and (apparently) Fmod static { @@ -59,7 +61,12 @@ public class NewtFactory { public static Class<?> getCustomClass(String packageName, String classBaseName) { Class<?> clazz = null; if(packageName!=null && classBaseName!=null) { - final String clazzName = packageName + "." + classBaseName ; + final String clazzName; + if( packageName.startsWith(".") ) { + clazzName = DRIVER_DEFAULT_ROOT_PACKAGE + packageName + "." + classBaseName ; + } else { + clazzName = packageName + "." + classBaseName ; + } try { clazz = Class.forName(clazzName); } catch (Throwable t) { |