summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/sun
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com/sun')
-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;
}