diff options
Diffstat (limited to 'src/jogl/classes/com/sun')
8 files changed, 33 insertions, 31 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/DRIHack.java b/src/jogl/classes/com/sun/opengl/impl/DRIHack.java index 5478bd2f3..63a2f7ecd 100755 --- a/src/jogl/classes/com/sun/opengl/impl/DRIHack.java +++ b/src/jogl/classes/com/sun/opengl/impl/DRIHack.java @@ -83,7 +83,7 @@ public class DRIHack { public static void begin() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - String os = System.getProperty("os.name").toLowerCase(); + String os = Debug.getProperty("os.name", false).toLowerCase(); // Do DRI hack on all Linux distributions for best robustness driHackNeeded = (os.startsWith("linux") || @@ -91,7 +91,7 @@ public class DRIHack { new File("/usr/X11R6/lib/modules/dri").exists()); // Allow manual overriding for now as a workaround for // problems seen in some situations -- needs more investigation - if (System.getProperty("jogl.drihack.disable") != null) { + if (Debug.getProperty("jogl.drihack.disable", true) != null) { driHackNeeded = false; } return null; diff --git a/src/jogl/classes/com/sun/opengl/impl/Debug.java b/src/jogl/classes/com/sun/opengl/impl/Debug.java index 9faa04fa7..b34b8e108 100644 --- a/src/jogl/classes/com/sun/opengl/impl/Debug.java +++ b/src/jogl/classes/com/sun/opengl/impl/Debug.java @@ -59,25 +59,37 @@ public class Debug { } } - public static boolean getBooleanProperty(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - boolean val = Boolean.getBoolean(property); - return (val ? Boolean.TRUE : Boolean.FALSE); - } - }); + public static int getIntProperty(final String property, final boolean jnlpAlias) { + int i=0; + try { + Integer iv = Integer.valueOf(Debug.getProperty(property, jnlpAlias)); + i = iv.intValue(); + } catch (NumberFormatException nfe) {} + return i; + } + + public static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { + Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias)); return b.booleanValue(); } public static boolean isPropertyDefined(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { + return (Debug.getProperty(property, true) != null) ? true : false; + } + + public static String getProperty(final String property, final boolean jnlpAlias) { + String s = (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String val = System.getProperty(property); - return (val != null ? Boolean.TRUE : Boolean.FALSE); + if(null==val && jnlpAlias && !property.startsWith(jnlp_prefix)) { + val = System.getProperty(jnlp_prefix + property); + } + return val; } }); - return b.booleanValue(); + return s; } + public static final String jnlp_prefix = "jnlp." ; public static boolean verbose() { return verbose; diff --git a/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java index 12dc8fc7d..5082f01dd 100644 --- a/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java +++ b/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -147,13 +147,8 @@ public class NativeLibLoader extends NativeLibLoaderBase { static { NativeLibLoaderBase.setLoadingAction(new JOGLAction()); - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher"); - usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue(); - return null; - } - }); + String sunAppletLauncher = Debug.getProperty("sun.jnlp.applet.launcher", false); + usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue(); } // I hate the amount of delegation currently in this class @@ -182,7 +177,7 @@ public class NativeLibLoader extends NativeLibLoaderBase { } } else { // FIXME: remove - // System.out.println("sun.boot.library.path=" + System.getProperty("sun.boot.library.path")); + // System.out.println("sun.boot.library.path=" + Debug.getProperty("sun.boot.library.path", false)); System.loadLibrary(libraryName); if(DEBUG) { System.err.println("JOGL Loaded Native Library: "+libraryName); diff --git a/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java b/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java index 6c8633c10..4a4b2d5f9 100644 --- a/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java @@ -62,7 +62,7 @@ public class ThreadingImpl { Object threadingPluginTmp = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - String workaround = System.getProperty("opengl.1thread"); + String workaround = Debug.getProperty("jogl.1thread", true); // Default to using the AWT thread on all platforms except // Windows. On OS X there is instability apparently due to // using the JAWT on non-AWT threads. On X11 platforms there diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java index a3d83ac36..d2907c83d 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -118,7 +118,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { // create a new EGL config .. ownEGLDisplay=true; long nDisplay; - if( NativeWindowFactory.getNativeWindowType(false)==NativeWindowFactory.TYPE_WINDOWS ) { + if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) { nDisplay = component.getSurfaceHandle(); // don't even ask .. } else { nDisplay = aDevice.getHandle(); // 0 == EGL.EGL_DEFAULT_DISPLAY diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java index 97080b5f7..8bed0eb35 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java @@ -181,7 +181,7 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper { private long dynamicLookupFunctionOnLibs(String glFuncName) { String funcName=glFuncName; long addr = dynamicLookupFunctionOnLibsImpl(funcName); - if( 0==addr && NativeWindowFactory.getNativeWindowType(false)==NativeWindowFactory.TYPE_WINDOWS ) { + if( 0==addr && NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) { // Hack: try some C++ decoration here for Imageon's emulation libraries .. final int argAlignment=4; // 4 byte alignment of each argument final int maxArguments=12; // experience .. diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 4a8712b06..33fdea384 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -17,12 +17,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { private static boolean isTigerOrLater; static { - String osVersion = - (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return System.getProperty("os.version"); - } - }); + String osVersion = Debug.getProperty("os.version", false); StringTokenizer tok = new StringTokenizer(osVersion, ". "); int major = Integer.parseInt(tok.nextToken()); int minor = Integer.parseInt(tok.nextToken()); diff --git a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java index 776045f41..c8dda5ed5 100755 --- a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java @@ -40,6 +40,7 @@ import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +import javax.media.nativewindow.NativeWindowFactory; import com.sun.opengl.impl.*; import com.sun.opengl.util.texture.*; import com.sun.opengl.util.texture.spi.*; @@ -1096,8 +1097,7 @@ public class Texture { // Prefer GL_ARB_texture_rectangle on ATI hardware on Mac OS X // due to software fallbacks - String osName = System.getProperty("os.name").toLowerCase(); - if (osName.startsWith("mac os x")) { + if (NativeWindowFactory.TYPE_MACOSX.equals(NativeWindowFactory.getNativeWindowType(false))) { String vendor = gl.glGetString(GL.GL_VENDOR); if (vendor != null && vendor.startsWith("ATI")) { return true; |