aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-06-18 06:50:13 +0000
committerSven Gothel <[email protected]>2009-06-18 06:50:13 +0000
commit3c6a7838b1a647b42cc8b37d1a433ed9a1431860 (patch)
tree2ed11714feef306f04e1c34beb71591f34563e21 /src/newt/classes
parent5607c14460e9e8abd2833517016f1dd3ec9c685c (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/classes')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/NewtFactory.java2
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/x11/X11Display.java22
2 files changed, 17 insertions, 7 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
index c9b230355..5eae559aa 100755
--- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
@@ -36,11 +36,13 @@ package com.sun.javafx.newt;
import javax.media.nativewindow.*;
import java.util.ArrayList;
import java.util.Iterator;
+import com.sun.nativewindow.impl.jvm.JVMUtil;
public abstract class NewtFactory {
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
+ JVMUtil.initSingleton();
Window.init(NativeWindowFactory.getNativeWindowType(true));
}
diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java b/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
index 99c0f599c..050b9b24d 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
@@ -33,10 +33,11 @@
package com.sun.javafx.newt.x11;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
+import com.sun.javafx.newt.*;
+import com.sun.javafx.newt.impl.*;
+import com.sun.nativewindow.impl.x11.X11Util;
public class X11Display extends Display {
static {
@@ -65,15 +66,23 @@ public class X11Display extends Display {
}
protected void createNative() {
- long handle= CreateDisplay(name);
+ long handle= X11Util.getThreadLocalDisplay(name);
if (handle == 0 ) {
throw new RuntimeException("Error creating display: "+name);
}
+ try {
+ CompleteDisplay(handle);
+ } catch(RuntimeException e) {
+ X11Util.closeThreadLocalDisplay(name);
+ throw e;
+ }
aDevice = new X11GraphicsDevice(handle);
}
protected void closeNative() {
- DestroyDisplay(getHandle());
+ if(0==X11Util.closeThreadLocalDisplay(name)) {
+ throw new NativeWindowException(this+" was not mapped");
+ }
}
protected void dispatchMessages() {
@@ -88,12 +97,11 @@ public class X11Display extends Display {
//
private static native boolean initIDs();
- private native long CreateDisplay(String name);
- private native void DestroyDisplay(long handle);
+ private native void CompleteDisplay(long handle);
private native void DispatchMessages(long display, long javaObjectAtom, long windowDeleteAtom);
- private void displayCreated(long javaObjectAtom, long windowDeleteAtom) {
+ private void displayCompleted(long javaObjectAtom, long windowDeleteAtom) {
this.javaObjectAtom=javaObjectAtom;
this.windowDeleteAtom=windowDeleteAtom;
}