diff options
21 files changed, 98 insertions, 92 deletions
diff --git a/make/make.jogl.all.linux-x86.sh b/make/make.jogl.all.linux-x86.sh index feb9f27e8..bb2f060ca 100644 --- a/make/make.jogl.all.linux-x86.sh +++ b/make/make.jogl.all.linux-x86.sh @@ -8,6 +8,7 @@ # -Dbuild.noarchives=true ant \ + -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86 \ -Drootrel.build=build-x86 \ -Dgluegen.cpptasks.detected.os=true \ diff --git a/make/make.jogl.all.linux-x86_64.sh b/make/make.jogl.all.linux-x86_64.sh index c84a2926c..1d9cf68fa 100644 --- a/make/make.jogl.all.linux-x86_64.sh +++ b/make/make.jogl.all.linux-x86_64.sh @@ -7,6 +7,7 @@ # -Dbuild.noarchives=true ant \ + -Dbuild.noarchives=true \ -Djogl.cg=1 -Dx11.cg.lib=../../lib-linux-x86_64 \ -Dc.compiler.debug=true \ -Drootrel.build=build-x86_64 \ diff --git a/make/make.jogl.all.macosx.sh b/make/make.jogl.all.macosx.sh index 037f4233a..e00cd83b6 100644 --- a/make/make.jogl.all.macosx.sh +++ b/make/make.jogl.all.macosx.sh @@ -6,6 +6,7 @@ # -Dbuild.noarchives=true ant \ + -Dbuild.noarchives=true \ -Djogl.cg=1 \ -Drootrel.build=build-macosx \ $* 2>&1 | tee make.jogl.all.macosx.log 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; diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index 6b1067701..f0450e89e 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -40,6 +40,7 @@ package javax.media.opengl; import javax.media.opengl.glu.*; +import com.sun.opengl.impl.Debug; /** A higher-level abstraction than {@link GLDrawable} which supplies an event based mechanism ({@link GLEventListener}) for performing @@ -111,7 +112,7 @@ public interface GLAutoDrawable extends GLDrawable { /** Flag reflecting wheather the drawable reconfiguration will be issued in * case a screen device change occured, e.g. in a multihead environment, * where you drag the window to another monitor. */ - public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Boolean.getBoolean("jogl.screenchange.action"); + public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true); /** FIXME: ** Invalid state, the resources are not yet ready to render. * diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 5da62c30a..3724556db 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -109,13 +109,7 @@ public abstract class GLDrawableFactory { String factoryClassName = null; tmp = null; try { - factoryClassName = - (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return System.getProperty("opengl.factory.class.name"); - } - }); - + factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); if (null == factoryClassName) { if ( nativeOSType.equals(NativeWindowFactory.TYPE_EGL) ) { // use egl*Factory .. diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java b/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java index 5d53f88fd..7e7b81e8b 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java +++ b/src/nativewindow/classes/com/sun/nativewindow/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/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index 023a9d488..1a9d4ac55 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -70,15 +70,11 @@ public abstract class GraphicsConfigurationFactory { } private static void initialize() { - String osName = System.getProperty("os.name"); - String osNameLowerCase = osName.toLowerCase(); String factoryClassName = null; abstractGraphicsDeviceClass = javax.media.nativewindow.AbstractGraphicsDevice.class; - if (!osNameLowerCase.startsWith("wind") && - !osNameLowerCase.startsWith("mac os x")) { - // Assume X11 platform -- should probably test for these explicitly + if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { try { GraphicsConfigurationFactory factory = (GraphicsConfigurationFactory) NWReflection.createInstance("com.sun.nativewindow.impl.x11.X11GraphicsConfigurationFactory", new Object[] {}); diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index e1e8970f4..4f1323ff8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -98,8 +98,8 @@ public abstract class NativeWindowFactory { JVMUtil.initSingleton(); // Gather the windowing OS first - nativeOSNamePure = System.getProperty("os.name"); - nativeOSNameCustom = System.getProperty("nativewindow.ws.name"); + nativeOSNamePure = Debug.getProperty("os.name", false); + nativeOSNameCustom = Debug.getProperty("nativewindow.ws.name", true); if(null==nativeOSNameCustom||nativeOSNameCustom.length()==0) { nativeOSNameCustom = nativeOSNamePure; } @@ -127,8 +127,8 @@ public abstract class NativeWindowFactory { } catch (Exception e) { } } - boolean toolkitLockForced = Boolean.getBoolean("nativewindow.locking"); - boolean awtToolkitLockDisabled = Boolean.getBoolean("java.awt.headless"); + boolean toolkitLockForced = Debug.getBooleanProperty("nativewindow.locking", true); + boolean awtToolkitLockDisabled = Debug.getBooleanProperty("java.awt.headless", false); NativeWindowFactory _factory = null; diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java index 5eae559aa..b5a555455 100755 --- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java +++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java @@ -46,17 +46,6 @@ public abstract class NewtFactory { Window.init(NativeWindowFactory.getNativeWindowType(true)); } - static int getPropertyIntValue(String propname) { - int i=0; - String s = System.getProperty(propname); - if(null!=s) { - try { - i = Integer.valueOf(s).intValue(); - } catch (NumberFormatException nfe) {} - } - return i; - } - /** * Create a Display entity, incl native creation */ diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java index 346257f6c..4c184bc99 100755 --- a/src/newt/classes/com/sun/javafx/newt/Screen.java +++ b/src/newt/classes/com/sun/javafx/newt/Screen.java @@ -33,6 +33,8 @@ package com.sun.javafx.newt; +import com.sun.javafx.newt.impl.*; + import javax.media.nativewindow.*; public abstract class Screen { @@ -60,8 +62,8 @@ public abstract class Screen { protected static Screen create(String type, Display display, int idx) { try { if(usrWidth<0 || usrHeight<0) { - usrWidth = NewtFactory.getPropertyIntValue("newt.ws.swidth"); - usrHeight = NewtFactory.getPropertyIntValue("newt.ws.sheight"); + usrWidth = Debug.getIntProperty("newt.ws.swidth", true); + usrHeight = Debug.getIntProperty("newt.ws.sheight", true); System.out.println("User screen size "+usrWidth+"x"+usrHeight); } Class screenClass = getScreenClass(type); diff --git a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java b/src/newt/classes/com/sun/javafx/newt/impl/Debug.java index a901eafb1..57ce88618 100644 --- a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java +++ b/src/newt/classes/com/sun/javafx/newt/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/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java b/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java index 06d76b294..4283ef6dc 100644 --- a/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java +++ b/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java @@ -99,13 +99,8 @@ public class NativeLibLoader extends NativeLibLoaderBase { static { NativeLibLoaderBase.setLoadingAction(new NEWTAction()); - 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 @@ -133,7 +128,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("NEWT NativeLibLoader loaded "+libraryName); diff --git a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java b/src/newt/classes/com/sun/javafx/newt/util/MainThread.java index bb3718a83..3230f504b 100644 --- a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java +++ b/src/newt/classes/com/sun/javafx/newt/util/MainThread.java @@ -81,8 +81,8 @@ import com.sun.nativewindow.impl.NWReflection; * Which starts 4 threads, each with a window and OpenGL rendering.<br> */ public class MainThread { - public static final boolean USE_MAIN_THREAD = NativeWindowFactory.getNativeWindowType(false)==NativeWindowFactory.TYPE_MACOSX || - Boolean.getBoolean("newt.MainThread.force"); + public static final boolean USE_MAIN_THREAD = NativeWindowFactory.TYPE_MACOSX.equals(NativeWindowFactory.getNativeWindowType(false)) || + Debug.getBooleanProperty("newt.MainThread.force", true); protected static final boolean DEBUG = Debug.debug("MainThread"); @@ -166,7 +166,7 @@ public class MainThread { mainAction = new MainAction(mainClassName, mainClassArgs); - if(NativeWindowFactory.getNativeWindowType(false)==NativeWindowFactory.TYPE_MACOSX) { + if(NativeWindowFactory.TYPE_MACOSX.equals(NativeWindowFactory.getNativeWindowType(false))) { MacDisplay.initSingleton(); } |