From 05cab54625f7482b1179cabe4902fbbbb53ea44d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 3 Jul 2009 04:34:02 +0000 Subject: Fix property handling ; Adding jnlp. aliasing for properties git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@2016 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../classes/com/sun/nativewindow/impl/Debug.java | 32 +++++++++++++++------- .../nativewindow/GraphicsConfigurationFactory.java | 6 +--- .../media/nativewindow/NativeWindowFactory.java | 8 +++--- 3 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src/nativewindow') 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; -- cgit v1.2.3