From 8a1e50dc33e14e9423e2f4bc066b32a835bb33fb Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Sun, 30 Sep 2012 00:51:39 +0200 Subject: _getNativeWindowingType() TYPE_BCM_VC_IV autodetection. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xerxes Rånby --- .../javax/media/nativewindow/NativeWindowFactory.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/nativewindow/classes/javax') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 4f4bb629b..d1ec3a4da 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -33,6 +33,7 @@ package javax.media.nativewindow; +import java.io.File; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; @@ -65,6 +66,9 @@ public abstract class NativeWindowFactory { /** X11 type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ public static final String TYPE_X11 = ".x11".intern(); + /** Broadcom VC IV/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ + public static final String TYPE_BCM_VC_IV = "jogamp.newt.driver.bcm.vc.iv".intern(); + /** Android/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ public static final String TYPE_ANDROID = ".android".intern(); @@ -102,6 +106,18 @@ public abstract class NativeWindowFactory { protected NativeWindowFactory() { } + private static final boolean guessBroadcomVCIV() { + return AccessController.doPrivileged(new PrivilegedAction() { + private final File vcliblocation = new File( + "/opt/vc/lib/libbcm_host.so"); + public Boolean run() { + if ( vcliblocation.isFile() ) { + return new Boolean(true); + } + return new Boolean(false); + } } ).booleanValue(); + } + private static String _getNativeWindowingType() { switch(Platform.OS_TYPE) { case ANDROID: @@ -118,6 +134,8 @@ public abstract class NativeWindowFactory { case SUNOS: case HPUX: default: + if(guessBroadcomVCIV()) + return TYPE_BCM_VC_IV; return TYPE_X11; } } -- cgit v1.2.3 From fa55b54822a256eb73147763829b946433c3d3f7 Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Sun, 30 Sep 2012 01:24:07 +0200 Subject: ".bcm.vc.iv" is enough now -> NEWT agnostic relative package path. --- .../classes/javax/media/nativewindow/NativeWindowFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nativewindow/classes/javax') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index d1ec3a4da..886c9af34 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -67,7 +67,7 @@ public abstract class NativeWindowFactory { public static final String TYPE_X11 = ".x11".intern(); /** Broadcom VC IV/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}. */ - public static final String TYPE_BCM_VC_IV = "jogamp.newt.driver.bcm.vc.iv".intern(); + public static final String TYPE_BCM_VC_IV = ".bcm.vc.iv".intern(); /** Android/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ public static final String TYPE_ANDROID = ".android".intern(); -- cgit v1.2.3 From 8351d513730009316b81149414ea87f3c631f9a2 Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Sun, 30 Sep 2012 01:32:35 +0200 Subject: Add braces and fix indentation to conform with jogl coding standards. --- .../classes/javax/media/nativewindow/NativeWindowFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nativewindow/classes/javax') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 886c9af34..ddacc2859 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -115,7 +115,8 @@ public abstract class NativeWindowFactory { return new Boolean(true); } return new Boolean(false); - } } ).booleanValue(); + } + } ).booleanValue(); } private static String _getNativeWindowingType() { @@ -134,8 +135,9 @@ public abstract class NativeWindowFactory { case SUNOS: case HPUX: default: - if(guessBroadcomVCIV()) + if( guessBroadcomVCIV() ) { return TYPE_BCM_VC_IV; + } return TYPE_X11; } } -- cgit v1.2.3