diff options
author | Sven Gothel <[email protected]> | 2009-08-10 14:02:05 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-08-10 14:02:05 -0700 |
commit | af51e1b06228c44adbb40eff1529eda7a6e9e408 (patch) | |
tree | aba9c08b9dd71908495e8a499b507603c4374024 | |
parent | 8ef9d7364a942c19ec5e1f306e08193e83f4fea6 (diff) |
NativeWindow: Add destroy() method, allowing external module to dispose a NativeWindow instance
3 files changed, 22 insertions, 0 deletions
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java index 48a04a3c9..800148b8d 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java @@ -57,6 +57,10 @@ public class NullWindow implements NativeWindow { protected void initNative() throws NativeWindowException { } + public void destroy() { + invalidate(); + } + public synchronized void invalidate() { displayHandle=0; scrnIndex=-1; diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java index 5ad2804c1..4bb240e94 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java @@ -39,6 +39,7 @@ package com.sun.nativewindow.impl.jawt; import com.sun.nativewindow.impl.*; import java.awt.Component; +import java.awt.Window; import java.awt.GraphicsEnvironment; import javax.media.nativewindow.*; import com.sun.nativewindow.impl.*; @@ -81,6 +82,15 @@ public abstract class JAWTWindow implements NativeWindow { drawable= 0; } + public synchronized void destroy() { + if(null!=component) { + if(component instanceof Window) { + ((Window)component).dispose(); + } + } + invalidate(); + } + private volatile Exception lockedStack = null; public synchronized int lockSurface() throws NativeWindowException { diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java index 6a588538d..cdac2de71 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java @@ -132,9 +132,17 @@ public interface NativeWindow { /** * render all native window information invalid, * as if the native window was destroyed + * + * @see #destroy */ public void invalidate(); + /** + * destroys the window and releases + * windowing related resources. + */ + public void destroy(); + /** * Returns the window handle for this NativeWindow. <P> * |