From 519776330c78e296d9868e959ddc64d00acac496 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 12 Dec 2010 18:43:36 +0100
Subject: Fix API doc: firstUIActionOnProcess
---
make/scripts/tests.sh | 4 +-
src/jogl/classes/javax/media/opengl/GLProfile.java | 4 +
.../media/nativewindow/NativeWindowFactory.java | 104 +++++++++++++++------
3 files changed, 79 insertions(+), 33 deletions(-)
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index f6b46f4aa..d0250b984 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -97,13 +97,13 @@ function testawt() {
#testawt com.jogamp.test.junit.jogl.awt.TestAWT03GLCanvasRecreate01 $*
#testawt com.jogamp.test.junit.jogl.awt.TestAWT02WindowClosing
#testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT
-testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT $*
+#testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT $*
#testawt com.jogamp.test.junit.jogl.texture.TestTexture01AWT
#
# newt.awt (testawt)
#
-#testawt com.jogamp.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
+testawt com.jogamp.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
#testawt com.jogamp.test.junit.jogl.demos.gl2.gears.newt.TestGearsNewtAWTWrapper
#testawt com.jogamp.test.junit.newt.TestEventSourceNotAWTBug
#testawt com.jogamp.test.junit.newt.TestFocus01SwingAWTRobot
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index d803b8dd5..4d181a7b8 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -70,6 +70,10 @@ public class GLProfile {
/**
* Static one time initialization of JOGL.
*
+ * The parameter firstUIActionOnProcess
has an impact on concurrent locking,
+ * see {@link javax.media.nativewindow.NativeWindowFactory#initSingleton(boolean) NativeWindowFactory.initSingleton(firstUIActionOnProcess)}.
+ *
+ *
* Applications shall call this methods ASAP, before any other UI invocation.
* You may issue the call in your main function.
* In case applications are able to initialize JOGL before any other UI action,
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 9e0aa28fa..860920123 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -134,7 +134,16 @@ public abstract class NativeWindowFactory {
/**
* Static one time initialization of this factory.
- * This initialization method must be called once by the program or utilizing modules!
+ * This initialization method must be called once by the program or utilizing modules!
+ *
+ * The parameter firstUIActionOnProcess
has an impact on concurrent locking:
+ *
+ * - {@link #getDefaultToolkitLock() getDefaultToolkitLock() }
+ * - {@link #getDefaultToolkitLock(java.lang.String) getDefaultToolkitLock(type) }
+ * - {@link #createDefaultToolkitLock(java.lang.String, long) createDefaultToolkitLock(type, dpyHandle) }
+ * - {@link #createDefaultToolkitLockNoAWT(java.lang.String, long) createDefaultToolkitLockNoAWT(type, dpyHandle) }
+ *
+ *
* @param firstUIActionOnProcess Should be true
if called before the first UI action of the running program,
* otherwise false
.
*/
@@ -281,10 +290,7 @@ public abstract class NativeWindowFactory {
/**
* Provides the system default {@link ToolkitLock}, a singleton instance.
*
- * This is a {@link com.jogamp.nativewindow.impl.jawt.JAWTToolkitLock}
- * in case of a X11 system and AWT availability and if
- * this factory has been initialized with {@link #initSingleton(boolean) initSingleton(firstUIActionOnProcess==true)},
- * otherwise {@link com.jogamp.nativewindow.impl.NullToolkitLock} is returned.
+ * @see #getDefaultToolkitLock(java.lang.String)
*/
public static ToolkitLock getDefaultToolkitLock() {
return getDefaultToolkitLock(getNativeWindowType(false));
@@ -293,15 +299,27 @@ public abstract class NativeWindowFactory {
/**
* Provides the default {@link ToolkitLock} for type
, a singleton instance.
*
- * This is a {@link com.jogamp.nativewindow.impl.jawt.JAWTToolkitLock}
- * in case of a X11 type or AWT type / X11 system and AWT availability and if
- * this factory has been initialized with {@link #initSingleton(boolean) initSingleton(firstUIActionOnProcess==true)},
- * otherwise {@link com.jogamp.nativewindow.impl.NullToolkitLock} is returned.
+ *
+ * - If {@link #initSingleton(boolean) initSingleton( firstUIActionOnProcess := false )}
+ *
+ * - If native X11 type with or w/o AWT
+ *
+ * - If AWT available
+ *
+ * - return {@link com.jogamp.nativewindow.impl.jawt.JAWTToolkitLock}
+ *
+ *
+ *
+ * - Otherwise return {@link com.jogamp.nativewindow.impl.NullToolkitLock}
+ *
*/
public static ToolkitLock getDefaultToolkitLock(String type) {
- if( isAWTAvailable() && !isFirstUIActionOnProcess() &&
- ( TYPE_X11 == type || TYPE_AWT == type && TYPE_X11 == getNativeWindowType(false) ) ) {
- return getAWTToolkitLock();
+ if( !isFirstUIActionOnProcess() ) {
+ if( TYPE_X11 == type || TYPE_AWT == type && TYPE_X11 == getNativeWindowType(false) ) {
+ if( isAWTAvailable() ) {
+ return getAWTToolkitLock();
+ }
+ }
}
return NativeWindowFactoryImpl.getNullToolkitLock();
}
@@ -319,39 +337,63 @@ public abstract class NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return NativeWindowFactoryImpl.getNullToolkitLock();
}
+
/**
* Creates the default {@link ToolkitLock} for type
and deviceHandle
.
*
- * This is a {@link com.jogamp.nativewindow.impl.jawt.x11.X11JAWTToolkitLock}
- * in case of a X11 type and AWT availability and if
- * this factory has been initialized with {@link #initSingleton(boolean) initSingleton(firstUIActionOnProcess==true)},
- * or a {@link com.jogamp.nativewindow.impl.x11.X11ToolkitLock}
- * in case of a X11 type and no AWT availability and if
- * this factory has been initialized with {@link #initSingleton(boolean) initSingleton(firstUIActionOnProcess==true)},
- * otherwise {@link com.jogamp.nativewindow.impl.NullToolkitLock} is returned.
+ *
+ * - If {@link #initSingleton(boolean) initSingleton( firstUIActionOnProcess := false )}
+ *
+ * - If X11 type
+ *
+ * - If AWT available
+ *
+ * - return {@link com.jogamp.nativewindow.impl.jawt.x11.X11JAWTToolkitLock}
+ *
+ * - If AWT not available
+ *
+ * - return {@link com.jogamp.nativewindow.impl.x11.X11ToolkitLock}
+ *
+ *
+ *
+ * - Otherwise return {@link com.jogamp.nativewindow.impl.NullToolkitLock}
+ *
*/
public static ToolkitLock createDefaultToolkitLock(String type, long deviceHandle) {
- if( TYPE_X11 == type ) {
- if( 0== deviceHandle ) {
- throw new RuntimeException("JAWTUtil.createDefaultToolkitLock() called with NULL device but on X11");
- }
- if( !isFirstUIActionOnProcess() ) {
+ if( !isFirstUIActionOnProcess() ) {
+ if( TYPE_X11 == type ) {
+ if( 0== deviceHandle ) {
+ throw new RuntimeException("JAWTUtil.createDefaultToolkitLock() called with NULL device but on X11");
+ }
if( isAWTAvailable() ) {
return createX11AWTToolkitLock(deviceHandle);
- } else {
- return createX11ToolkitLock(deviceHandle);
}
+ return createX11ToolkitLock(deviceHandle);
}
}
return NativeWindowFactoryImpl.getNullToolkitLock();
}
+ /**
+ * Creates the default {@link ToolkitLock} for type
and deviceHandle
.
+ *
+ *
+ * - If {@link #initSingleton(boolean) initSingleton( firstUIActionOnProcess := false )}
+ *
+ * - If X11 type
+ *
+ * - return {@link com.jogamp.nativewindow.impl.x11.X11ToolkitLock}
+ *
+ *
+ * - Otherwise return {@link com.jogamp.nativewindow.impl.NullToolkitLock}
+ *
+ */
public static ToolkitLock createDefaultToolkitLockNoAWT(String type, long deviceHandle) {
- if( TYPE_X11 == type ) {
- if( 0== deviceHandle ) {
- throw new RuntimeException("JAWTUtil.createDefaultToolkitLockNoAWT() called with NULL device but on X11");
- }
- if( !isFirstUIActionOnProcess() ) {
+ if( !isFirstUIActionOnProcess() ) {
+ if( TYPE_X11 == type ) {
+ if( 0== deviceHandle ) {
+ throw new RuntimeException("JAWTUtil.createDefaultToolkitLockNoAWT() called with NULL device but on X11");
+ }
return createX11ToolkitLock(deviceHandle);
}
}
--
cgit v1.2.3