diff options
author | Sven Gothel <[email protected]> | 2009-07-03 04:34:02 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-07-03 04:34:02 +0000 |
commit | 05cab54625f7482b1179cabe4902fbbbb53ea44d (patch) | |
tree | 366001efdb204266f59910145010183a2411af45 /src/newt/classes/com | |
parent | d6ec90ca7bfe9ee217386365c819659c161a10f6 (diff) |
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
Diffstat (limited to 'src/newt/classes/com')
5 files changed, 32 insertions, 34 deletions
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(); } |