summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-06-12 02:55:29 +0200
committerSven Gothel <[email protected]>2011-06-12 02:55:29 +0200
commitbd1c8685d10a82108f959aae5a2f39b5570446be (patch)
tree9167079f2a4852115618c62d4282013b8769d64b
parentfec792f54c29ea86a39330f1a2adb816003443a6 (diff)
X11/Newt Locking: Clarify dependency of XInitThreads() hack
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java9
-rw-r--r--src/newt/classes/jogamp/newt/x11/X11Display.java11
2 files changed, 14 insertions, 6 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 26da46319..8a6869d91 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -61,15 +61,18 @@ public class X11Util {
private static int setX11ErrorHandlerRecCount = 0;
private static Object setX11ErrorHandlerLock = new Object();
+ public static final boolean XINITTHREADS_ALWAYS_ENABLED = true;
+
public static synchronized void initSingleton(boolean firstX11ActionOnProcess) {
if(!isInit) {
NWJNILibLoader.loadNativeWindow("x11");
/**
* Always issue XInitThreads() since we have independent
- * off-thread created Display connections able to utilize multithreading, ie NEWT */
- initialize0( true );
- // initialize0( firstX11ActionOnProcess );
+ * off-thread created Display connections able to utilize multithreading,
+ * ie NEWT (jogamp.newt.x11.X11Display.createNativeImpl()) !!
+ */
+ initialize0( XINITTHREADS_ALWAYS_ENABLED ? true : firstX11ActionOnProcess );
isFirstX11ActionOnProcess = firstX11ActionOnProcess;
if(DEBUG) {
diff --git a/src/newt/classes/jogamp/newt/x11/X11Display.java b/src/newt/classes/jogamp/newt/x11/X11Display.java
index d4a83abe0..815395e2d 100644
--- a/src/newt/classes/jogamp/newt/x11/X11Display.java
+++ b/src/newt/classes/jogamp/newt/x11/X11Display.java
@@ -75,9 +75,14 @@ public class X11Display extends DisplayImpl {
X11Util.closeDisplay(handle);
throw e;
}
- aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.getNullToolkitLock());
- // aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.createDefaultToolkitLockNoAWT(NativeWindowFactory.TYPE_X11, handle));
- // aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT);
+
+ if(X11Util.XINITTHREADS_ALWAYS_ENABLED) {
+ // Hack: Force non X11Display locking, even w/ AWT and w/o isFirstUIActionOnProcess()
+ aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.getNullToolkitLock());
+ } else {
+ // Proper: Use AWT/X11Display locking w/ AWT and X11Display locking only w/o isFirstUIActionOnProcess()
+ aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT);
+ }
}
protected void closeNativeImpl() {