summaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java11
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java12
2 files changed, 18 insertions, 5 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index adc946f70..9bc8ca9e4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -195,9 +195,10 @@ public abstract class NativeWindowFactory {
final ClassLoader cl = NativeWindowFactory.class.getClassLoader();
- // X11 initialization before possible AWT initialization
- initNativeImpl(firstUIActionOnProcess, cl);
-
+ if(firstUIActionOnProcess) {
+ // X11 initialization before possible AWT initialization
+ initNativeImpl(true, cl);
+ }
isAWTAvailable = false; // may be set to true below
if( !Debug.getBooleanProperty("java.awt.headless", true, acc) &&
@@ -229,6 +230,10 @@ public abstract class NativeWindowFactory {
}
}
}
+ if(!firstUIActionOnProcess) {
+ // X11 initialization after possible AWT initialization
+ initNativeImpl(false, cl);
+ }
registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>());
// register our default factory -> NativeWindow
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 94a47d0f7..bc43a9a97 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -73,8 +73,12 @@ public class X11Util {
* </p>
*/
public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = true;
+
+ /** Value is <code>true</code>, best 'stable' results if always using XInitThreads(). */
+ public static final boolean XINITTHREADS_ALWAYS_ENABLED = true;
- // public static final boolean HAS_XLOCKDISPLAY_BUG = false;
+ /** Value is <code>true</code>, best 'stable' results if not using XLockDisplay/XUnlockDisplay at all. */
+ public static final boolean HAS_XLOCKDISPLAY_BUG = true;
private static final boolean DEBUG = Debug.debug("X11Util");
private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.getBooleanProperty("nativewindow.debug.X11Util.TraceDisplayLifecycle", true, AccessController.getContext());
@@ -89,15 +93,19 @@ public class X11Util {
private static Object setX11ErrorHandlerLock = new Object();
+ @SuppressWarnings("unused")
public static synchronized void initSingleton(final boolean firstX11ActionOnProcess) {
if(!isInit) {
NWJNILibLoader.loadNativeWindow("x11");
- isX11LockAvailable = initialize0( firstX11ActionOnProcess ) /* && !HAS_XLOCKDISPLAY_BUG */ ;
+ final boolean callXInitThreads = XINITTHREADS_ALWAYS_ENABLED || firstX11ActionOnProcess;
+ final boolean isXInitThreadsOK = initialize0( XINITTHREADS_ALWAYS_ENABLED || firstX11ActionOnProcess );
+ isX11LockAvailable = isXInitThreadsOK && !HAS_XLOCKDISPLAY_BUG ;
if(DEBUG) {
System.err.println("X11Util firstX11ActionOnProcess: "+firstX11ActionOnProcess+
", requiresX11Lock "+requiresX11Lock+
+ ", XInitThreads [called "+callXInitThreads+", OK "+isXInitThreadsOK+"]"+
", isX11LockAvailable "+isX11LockAvailable);
// Thread.dumpStack();
}