diff options
author | Sven Gothel <[email protected]> | 2011-11-25 03:02:08 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-25 03:02:08 +0100 |
commit | 9ef0a0c185ace5217efc014809e97c5eead842cc (patch) | |
tree | 8ee17bcf85e3988930e8fe431fe63210b6a6aa47 /src/nativewindow | |
parent | 6b8f6e8d7c548cb6bfed14d8a04c9cf252ca7c4d (diff) |
JAWTWindow: remove validateNative() ..
- remove validateNative()
- don't dispose AWT component, since we are an immutable uplink (was disposed if Window)
Diffstat (limited to 'src/nativewindow')
4 files changed, 3 insertions, 60 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java index 2d695b84d..a75af0be3 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java @@ -41,7 +41,6 @@ import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import java.awt.Component; -import java.awt.Window; import java.applet.Applet; import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -89,7 +88,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface throw new NativeWindowException("Error: AbstractGraphicsConfiguration is null"); } if(! ( config instanceof AWTGraphicsConfiguration ) ) { - throw new NativeWindowException("Error: AbstractGraphicsConfiguration is not an AWTGraphicsConfiguration"); + throw new NativeWindowException("Error: AbstractGraphicsConfiguration is not an AWTGraphicsConfiguration: "+config); } this.config = (AWTGraphicsConfiguration) config; init((Component)comp); @@ -99,7 +98,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface invalidate(); this.component = windowObject; this.isApplet = false; - validateNative(); } /** @@ -118,17 +116,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface return shallUseOffscreenLayer; } - /** - * Implementors shall ensure that all native handles are valid, eg. the {@link javax.media.nativewindow.awt.AWTGraphicsDevice AWTGraphicsDevice}'s - * subtype via {@link javax.media.nativewindow.awt.AWTGraphicsDevice#setSubType(String, long) awtGraphicsDevice.setSubType(NativeWindowFactory.TYPE_X11, displayHandle)}. - * <p> - * This method may be called several times, - * hence the implementation shall check for valid values 1st and bail out early if satisfied. - * </p> - * @throws NativeWindowException - */ - protected abstract void validateNative() throws NativeWindowException; - protected synchronized void invalidate() { invalidateNative(); jawt = null; @@ -266,7 +253,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface protected abstract int lockSurfaceImpl() throws NativeWindowException; public final int lockSurface() throws NativeWindowException { - validateNative(); surfaceLock.lock(); int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ? @@ -358,13 +344,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface // public synchronized void destroy() { - invalidate(); - if(null!=component) { - if(component instanceof Window) { - ((Window)component).dispose(); - } - component = null; - } + invalidate(); + component = null; // don't dispose the AWT component, since we are merely an immutable uplink } public final NativeWindow getParent() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index e59137fda..11c21a68a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -67,9 +67,6 @@ public class MacOSXJAWTWindow extends JAWTWindow implements SurfaceChangeable { } } - protected void validateNative() throws NativeWindowException { - } - protected void invalidateNative() { surfaceHandle=0; if(isOffscreenLayerSurfaceEnabled()) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index adb9353ce..157f750f1 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -59,9 +59,6 @@ public class WindowsJAWTWindow extends JAWTWindow { super(comp, config); } - protected void validateNative() throws NativeWindowException { - } - protected void invalidateNative() { windowHandle = 0; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index 965dc7990..10b760a50 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java @@ -38,12 +38,8 @@ package jogamp.nativewindow.jawt.x11; import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsDevice; -import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.nativewindow.awt.AWTGraphicsDevice; import javax.media.nativewindow.util.Point; import jogamp.nativewindow.jawt.JAWT; @@ -60,34 +56,6 @@ public class X11JAWTWindow extends JAWTWindow { super(comp, config); } - protected void validateNative() throws NativeWindowException { - // FIXME: REMOVE !!!!!!!! - final AWTGraphicsDevice awtDevice = (AWTGraphicsDevice) getPrivateGraphicsConfiguration().getScreen().getDevice(); - - if(awtDevice.getHandle() != 0) { - // subtype and handle set already, done - return; - } - - long displayHandle = 0; - - // first try a pre-existing attached native configuration, ie native X11GraphicsDevice - AbstractGraphicsConfiguration aconfig = getGraphicsConfiguration(); - AbstractGraphicsScreen ascreen = (null!=aconfig) ? aconfig.getScreen() : null; - AbstractGraphicsDevice adevice = (null!=ascreen) ? ascreen.getDevice() : null; // X11GraphicsDevice - if(null!=adevice) { - displayHandle = adevice.getHandle(); - } - - if(0 == displayHandle) { - displayHandle = X11SunJDKReflection.graphicsDeviceGetDisplay(awtDevice.getGraphicsDevice()); - } - if(0==displayHandle) { - throw new InternalError("X11JAWTWindow: No X11 Display handle available"); - } - awtDevice.setSubType(NativeWindowFactory.TYPE_X11, displayHandle); - } - protected void invalidateNative() { } protected void attachSurfaceLayerImpl(final long layerHandle) { |