diff options
author | Sven Gothel <[email protected]> | 2009-10-11 07:41:31 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-11 07:41:31 -0700 |
commit | 8f76db4364f66c36780e762e086a18d5cc315363 (patch) | |
tree | 6c3291b08c76018bda59ad6fe3acf8fe686d0eb4 /src/newt/classes/com/sun/javafx | |
parent | 6f6436ab9c7345f4d3b7bf5d8ee70addc9f11ab0 (diff) |
NEWT X11 Display Lock:
Integrate Display.lock/unlock,
so the generic Window will call it.
Specialized for X11Display, the only real impl of it.
Fixes offscreen EDT usage ..
GLProfile:
Add isAWTAvailable() and isAWTJOGLAvailable()
TextureIO:
- Add NetPbmTextureWriter
- Only use IIOTexture* if !isAWTJOGLAvailable()
- Add write (TextureData, File)
Diffstat (limited to 'src/newt/classes/com/sun/javafx')
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; |