diff options
author | Sven Gothel <[email protected]> | 2011-11-25 03:06:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-25 03:06:56 +0100 |
commit | 0314be79a7a93931a74fe4322bc78e699d7741e9 (patch) | |
tree | f5f9be82bc3c2acbf6f8122c60a5d2d1c3f5cc99 /src/nativewindow/native/x11/Xmisc.c | |
parent | 9ef0a0c185ace5217efc014809e97c5eead842cc (diff) |
NativeWindow X11 Locking: Fix XInitThreads/XLockDisplay/XUnlockDisplay Usage ;
XLockDisplay/XUnlockDisplay shall only be used if XInitThreads() was successful,
otherwise it has no effect (X11 spec).
- Only issue XInitThreads() if firstX11ActionOnProcess==true,
store result to determing whether we can utilize XLockDisplay/XUnlockDisplay.
- If we cannot utilize XLockDisplay/XUnlockDisplay, use RecursiveLock
- NativeWindowFactory: Only return AWTToolkitLock or X11JAWTToolkitLock if explicitly requested
Diffstat (limited to 'src/nativewindow/native/x11/Xmisc.c')
-rw-r--r-- | src/nativewindow/native/x11/Xmisc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c index d481343f9..8b56bca90 100644 --- a/src/nativewindow/native/x11/Xmisc.c +++ b/src/nativewindow/native/x11/Xmisc.c @@ -293,14 +293,16 @@ static void x11IOErrorHandlerEnable(int onoff, JNIEnv * env) { } static int _initialized=0; +static jboolean _xinitThreadsOK=JNI_FALSE; -JNIEXPORT void JNICALL +JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_x11_X11Util_initialize0(JNIEnv *env, jclass _unused, jboolean firstUIActionOnProcess) { if(0==_initialized) { if( JNI_TRUE == firstUIActionOnProcess ) { if( 0 == XInitThreads() ) { fprintf(stderr, "Warning: XInitThreads() failed\n"); } else { + _xinitThreadsOK=JNI_TRUE; fprintf(stderr, "Info: XInitThreads() called for concurrent Thread support\n"); } } else { @@ -311,6 +313,7 @@ Java_jogamp_nativewindow_x11_X11Util_initialize0(JNIEnv *env, jclass _unused, jb x11IOErrorHandlerEnable(1, env); _initialized=1; } + return _xinitThreadsOK; } JNIEXPORT void JNICALL |