summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java37
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java29
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java6
4 files changed, 53 insertions, 21 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index a7231efc8..f76ad5d24 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -43,9 +43,13 @@ import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.DesktopGLDynamicLookupHelper;
import com.jogamp.common.GlueGenVersion;
-import com.jogamp.common.jvm.JVMUtil;
+import com.jogamp.common.jvm.JNILibLoaderBase;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
+import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.common.util.VersionUtil;
+import com.jogamp.common.util.cache.TempJarCache;
import com.jogamp.nativewindow.NativeWindowVersion;
import com.jogamp.opengl.JoglVersion;
@@ -53,6 +57,7 @@ import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.fixedfunc.GLPointerFunc;
+import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
@@ -107,8 +112,34 @@ public class GLProfile {
initialized = true;
// run the whole static initialization privileged to speed up,
// since this skips checking further access
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
+ if(TempJarCache.isInitialized()) {
+ final Class<?> c = GLProfile.class;
+ final ClassLoader cl = c.getClassLoader();
+ try {
+ final String jarName = JarUtil.getJarName(c.getName(), cl);
+ if(DEBUG) {
+ System.err.println("GLProfile classURL: "+IOUtil.getClassURL(c.getName(), cl));
+ System.err.println("GLProfile jarName: "+jarName);
+ }
+ if(jarName!=null) {
+ if( jarName.startsWith("jogl.all") ) {
+ // all-in-one variant
+ JNILibLoaderBase.addNativeJarLibs(c, "jogl-all");
+ } else {
+ // atomic variant
+ JNILibLoaderBase.addNativeJarLibs(c, "nativewindow");
+ JNILibLoaderBase.addNativeJarLibs(c, "jogl");
+ if( ReflectionUtil.isClassAvailable("com.jogamp.newt.NewtFactory", cl) ) {
+ JNILibLoaderBase.addNativeJarLibs(c, "newt");
+ }
+ }
+ }
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
initProfilesForDefaultDevices(firstUIActionOnProcess);
return null;
}
@@ -1142,7 +1173,7 @@ public class GLProfile {
}
static {
- JVMUtil.initSingleton();
+ Platform.initSingleton();
}
private static /*final*/ boolean isAWTAvailable;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index b7f207752..5c01c681a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -37,7 +37,6 @@ import java.security.*;
import java.util.*;
import com.jogamp.common.util.*;
-import com.jogamp.common.jvm.JVMUtil;
import com.jogamp.common.os.Platform;
import jogamp.nativewindow.*;
@@ -75,8 +74,8 @@ public abstract class NativeWindowFactory {
public static final String TYPE_DEFAULT = "default";
private static NativeWindowFactory defaultFactory;
- private static Map/*<Class, NativeWindowFactory>*/ registeredFactories;
- private static Class nativeWindowClass;
+ private static Map<Class<?>, NativeWindowFactory> registeredFactories;
+ private static Class<?> nativeWindowClass;
private static String nativeWindowingTypePure;
private static String nativeWindowingTypeCustom;
private static boolean isAWTAvailable;
@@ -86,13 +85,13 @@ public abstract class NativeWindowFactory {
public static final String GDIClassName = "jogamp.nativewindow.windows.GDI";
public static final String X11JAWTToolkitLockClassName = "jogamp.nativewindow.jawt.x11.X11JAWTToolkitLock" ;
public static final String X11ToolkitLockClassName = "jogamp.nativewindow.x11.X11ToolkitLock" ;
- private static Class jawtUtilClass;
+ private static Class<?> jawtUtilClass;
private static Method jawtUtilGetJAWTToolkitMethod;
private static Method jawtUtilInitMethod;
- private static Class x11JAWTToolkitLockClass;
- private static Constructor x11JAWTToolkitLockConstructor;
- private static Class x11ToolkitLockClass;
- private static Constructor x11ToolkitLockConstructor;
+ private static Class<?> x11JAWTToolkitLockClass;
+ private static Constructor<?> x11JAWTToolkitLockConstructor;
+ private static Class<?> x11ToolkitLockClass;
+ private static Constructor<?> x11ToolkitLockConstructor;
private static boolean isFirstUIActionOnProcess;
private static boolean requiresToolkitLock;
@@ -122,7 +121,7 @@ public abstract class NativeWindowFactory {
}
static {
- JVMUtil.initSingleton();
+ Platform.initSingleton();
DEBUG = Debug.debug("NativeWindow");
if(DEBUG) {
Throwable td = new Throwable(Thread.currentThread().getName()+" - Info: NativeWindowFactory.<init>");
@@ -227,7 +226,7 @@ public abstract class NativeWindowFactory {
// X11 initialization after possible AWT initialization
initNativeImpl(false, cl);
}
- registeredFactories = Collections.synchronizedMap(new HashMap());
+ registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>());
// register our default factory -> NativeWindow
NativeWindowFactory factory = new NativeWindowFactoryImpl();
@@ -412,13 +411,13 @@ public abstract class NativeWindowFactory {
already assumed the responsibility of creating a compatible
NativeWindow implementation, or it might be that of a toolkit
class like {@link java.awt.Component Component}. */
- public static NativeWindowFactory getFactory(Class windowClass) throws IllegalArgumentException {
+ public static NativeWindowFactory getFactory(Class<?> windowClass) throws IllegalArgumentException {
if (nativeWindowClass.isAssignableFrom(windowClass)) {
- return (NativeWindowFactory) registeredFactories.get(nativeWindowClass);
+ return registeredFactories.get(nativeWindowClass);
}
- Class clazz = windowClass;
+ Class<?> clazz = windowClass;
while (clazz != null) {
- NativeWindowFactory factory = (NativeWindowFactory) registeredFactories.get(clazz);
+ NativeWindowFactory factory = registeredFactories.get(clazz);
if (factory != null) {
return factory;
}
@@ -430,7 +429,7 @@ public abstract class NativeWindowFactory {
/** Registers a NativeWindowFactory handling window objects of the
given class. This does not need to be called by end users,
only implementors of new NativeWindowFactory subclasses. */
- protected static void registerFactory(Class windowClass, NativeWindowFactory factory) {
+ protected static void registerFactory(Class<?> windowClass, NativeWindowFactory factory) {
if(DEBUG) {
System.err.println("NativeWindowFactory.registerFactory() "+windowClass+" -> "+factory);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
index 1ac9e1709..2c8538278 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
@@ -48,7 +48,7 @@ import java.security.PrivilegedAction;
public class JAWTJNILibLoader extends NWJNILibLoader {
public static void loadAWTImpl() {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
// Make sure that awt.dll is loaded before loading jawt.dll. Otherwise
// a Dialog with "awt.dll not found" might pop up.
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 62da8c978..d3be098c0 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -35,7 +35,9 @@
package com.jogamp.newt;
import javax.media.nativewindow.*;
-import com.jogamp.common.jvm.JVMUtil;
+
+import com.jogamp.common.os.Platform;
+
import jogamp.newt.DisplayImpl;
import jogamp.newt.ScreenImpl;
import jogamp.newt.WindowImpl;
@@ -47,7 +49,7 @@ public class NewtFactory {
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
- JVMUtil.initSingleton();
+ Platform.initSingleton();
NativeWindowFactory.initSingleton(false); // last resort ..
WindowImpl.init(NativeWindowFactory.getNativeWindowType(true));
}