diff options
author | Sven Gothel <[email protected]> | 2009-06-18 06:50:13 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-06-18 06:50:13 +0000 |
commit | 3c6a7838b1a647b42cc8b37d1a433ed9a1431860 (patch) | |
tree | 2ed11714feef306f04e1c34beb71591f34563e21 /src/newt/native | |
parent | 5607c14460e9e8abd2833517016f1dd3ec9c685c (diff) |
- Fix: X11 locking
The current thread default display or
the given display is being used,
hence it is no more required to use a ToolkitLock
for X11 without AWT.
Removed X11 ToolkitLock in case of X11 without AWT,
which is being detected with the absence of the classes
java.awt.Component _AND_ javax.media.nativewindow.awt.AWTGraphicsDevice
or with the system property
java.awt.headless=true
Only in the Java2D/Swing case, one 'leaking' Display
is created within canCreateGLPbuffer().
- Workaround for Hotsport bugs #4395095, #6852404
4395095 JNI access to java.nio DirectBuffer constructor/accessor
6852404 Race condition in JNI Direct Buffer access and creation routines
- Added build.xml
-Dbuild.noarchives=true property to skip the time consuming
creation of zip archives.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1988 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/native')
-rwxr-xr-x | src/newt/native/X11Window.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index c239dd780..8651a8cea 100755 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -156,7 +156,7 @@ static jmethodID windowCreatedID = NULL; static jmethodID sendMouseEventID = NULL; static jmethodID sendKeyEventID = NULL; -static jmethodID displayCreatedID = NULL; +static jmethodID displayCompletedID = NULL; static void _throwNewRuntimeException(JNIEnv *env, const char* msg, ...) { @@ -184,8 +184,8 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs { jclass c; - displayCreatedID = (*env)->GetMethodID(env, clazz, "displayCreated", "(JJ)V"); - if (displayCreatedID == NULL) { + displayCompletedID = (*env)->GetMethodID(env, clazz, "displayCompleted", "(JJ)V"); + if (displayCompletedID == NULL) { return JNI_FALSE; } @@ -223,60 +223,34 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs /* * Class: com_sun_javafx_newt_x11_X11Display - * Method: CreateDisplay - * Signature: (Ljava/lang/String;)J + * Method: CompleteDisplay + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Display_CreateDisplay - (JNIEnv *env, jobject obj, jstring displayName) +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_CompleteDisplay + (JNIEnv *env, jobject obj, jlong display) { - Display * dpy = NULL; - const char * _displayName = NULL; + Display * dpy = (Display *)(intptr_t)display; jlong javaObjectAtom; jlong windowDeleteAtom; - if(displayName!=0) { - _displayName = (*env)->GetStringUTFChars(env, displayName, 0); - } - DBG_PRINT1("open display connection for %s ..\n", ((NULL==_displayName)?"NULL":_displayName)); - dpy = XOpenDisplay(_displayName); if(dpy==NULL) { - _throwNewRuntimeException(env, "couldn't open display connection for %s\n", ((NULL==_displayName)?"NULL":_displayName)); - } - if(_displayName!=0) { - (*env)->ReleaseStringChars(env, displayName, (const jchar *)_displayName); + _throwNewRuntimeException(env, "given display connection is NULL\n"); } javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False); if(None==javaObjectAtom) { - XCloseDisplay(dpy); _throwNewRuntimeException(env, "could not create Atom JOGL_JAVA_OBJECT, bail out!\n"); - return 0; + return; } windowDeleteAtom = (jlong) XInternAtom(dpy, "WM_DELETE_WINDOW", False); if(None==windowDeleteAtom) { - XCloseDisplay(dpy); _throwNewRuntimeException(env, "could not create Atom WM_DELETE_WINDOW, bail out!\n"); - return 0; + return; } - DBG_PRINT1("X11Display_CreateDisplay dpy %p\n", dpy); - - (*env)->CallVoidMethod(env, obj, displayCreatedID, javaObjectAtom, windowDeleteAtom); + DBG_PRINT1("X11Display_completeDisplay dpy %p\n", dpy); - return (jlong) (intptr_t) dpy; -} - -/* - * Class: com_sun_javafx_newt_x11_X11Display - * Method: DestroyDisplay - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DestroyDisplay - (JNIEnv *env, jobject obj, jlong display) -{ - Display * dpy = (Display *)(intptr_t)display; - DBG_PRINT1("X11Display_DestroyDisplay dpy %p\n", dpy); - XCloseDisplay(dpy); + (*env)->CallVoidMethod(env, obj, displayCompletedID, javaObjectAtom, windowDeleteAtom); } static int putPtrIn32Long(unsigned long * dst, uintptr_t src) { |