summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Display.java6
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java2
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/x11/X11Display.java7
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/x11/X11Window.java21
4 files changed, 13 insertions, 23 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java
index ad4664ac8..97d5465c9 100755
--- a/src/newt/classes/com/sun/javafx/newt/Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/Display.java
@@ -261,6 +261,12 @@ public abstract class Display {
protected abstract void dispatchMessages();
+ /** Default impl. nop - Currently only X11 needs a Display lock */
+ protected void lockDisplay() { }
+
+ /** Default impl. nop - Currently only X11 needs a Display lock */
+ protected void unlockDisplay() { }
+
protected EventDispatchThread eventDispatchThread = null;
protected String name;
protected int refCount;
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index b9d8bde42..8260b1a16 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -286,6 +286,7 @@ public abstract class Window implements NativeWindow
}
owner = cur;
lockedStack = new Exception("NEWT Surface previously locked by "+Thread.currentThread());
+ screen.getDisplay().lockDisplay();
return LOCK_SUCCESS;
}
@@ -302,6 +303,7 @@ public abstract class Window implements NativeWindow
}
owner = null;
lockedStack = null;
+ screen.getDisplay().unlockDisplay();
notifyAll();
// We leave the ToolkitLock unlock to the specializtion's discretion,
// ie the implicit JAWTWindow in case of AWTWindow
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 297f98edb..ae23c4423 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
@@ -84,17 +84,18 @@ public class X11Display extends Display {
DispatchMessages(getHandle(), javaObjectAtom, windowDeleteAtom);
}
- protected long getJavaObjectAtom() { return javaObjectAtom; }
- protected long getWindowDeleteAtom() { return windowDeleteAtom; }
-
protected void lockDisplay() {
+ super.lockDisplay();
LockDisplay(getHandle());
}
protected void unlockDisplay() {
UnlockDisplay(getHandle());
+ super.unlockDisplay();
}
+ protected long getJavaObjectAtom() { return javaObjectAtom; }
+ protected long getWindowDeleteAtom() { return windowDeleteAtom; }
//----------------------------------------------------------------------
// Internals only
diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java
index 94eb98299..f46ae9564 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java
@@ -71,7 +71,7 @@ public class X11Window extends Window {
}
protected void closeNative() {
- if(0!=displayHandleClose && 0!=windowHandleClose) {
+ if(0!=displayHandleClose && 0!=windowHandleClose && null!=getScreen() ) {
X11Display display = (X11Display) getScreen().getDisplay();
CloseWindow(displayHandleClose, windowHandleClose, display.getJavaObjectAtom());
windowHandleClose = 0;
@@ -85,25 +85,6 @@ public class X11Window extends Window {
super.windowDestroyed();
}
- public synchronized int lockSurface() throws NativeWindowException {
- int res = super.lockSurface();
- if(LOCK_SUCCESS == res) {
- ((X11Display)(screen.getDisplay())).lockDisplay();
- }
- return res;
- }
-
- public synchronized void unlockSurface() {
- // prevalidate, before we change data ..
- Thread cur = Thread.currentThread();
- if ( getSurfaceLockOwner() != cur ) {
- getLockedStack().printStackTrace();
- throw new NativeWindowException(cur+": Not owner, owner is "+getSurfaceLockOwner());
- }
- ((X11Display)(screen.getDisplay())).unlockDisplay();
- super.unlockSurface();
- }
-
public void setVisible(boolean visible) {
if(0!=windowHandle && this.visible!=visible) {
this.visible=visible;