diff options
author | Sven Gothel <[email protected]> | 2011-09-08 03:43:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-08 03:43:54 +0200 |
commit | 28b0df6c300494a2b54c07fdf43ef04f5f1b0073 (patch) | |
tree | 5548d07457fddd4390889c037b63ca20879fa353 /src/newt/classes/com | |
parent | f1c375df106f0f9f6c90772b61a501b4280997fa (diff) |
Destruction of GLAutoDrawable shall not remove them from AnimatorControl (due to recreation) ; NEWT/Window: Remove isValid() API entry - always true!
Destruction of GLAutoDrawable shall not remove them from AnimatorControl (due to recreation)
- Completes commit b65e1e76d413b70e5593173e6bd36d30675554a6
- WindowImpl:
- volatile: windowHandle/visible fields (memeory sync critical)
- destroy must set visible := false, to avoid immediate recreation via
a display call of another thread, ie an animator.
NEWT/Window: Remove isValid() API entry - always true!
- NEWT/Window's can always be recreated.
- redundancy in API is even worse than redundancy in impl. :)
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/Window.java | 12 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 8 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 28 |
3 files changed, 12 insertions, 36 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index ac8311a9a..84f2f0294 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -55,17 +55,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol { // /** - * @return True if native window is valid, can be created or recovered. - * Otherwise false, ie this window is unrecoverable due to a <code>destroy(true)</code> call. - * - * @see #destroy(boolean) - * @see #setVisible(boolean) - */ - boolean isValid(); - - /** * @return true if the native window handle is valid and ready to operate, ie - * if the native window has been created, otherwise false. + * if the native window has been created via {@link #setVisible(boolean) setVisible(true)}, otherwise false. * * @see #setVisible(boolean) * @see #destroy(boolean) @@ -102,6 +93,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { /** * Destroy the Window and it's children, incl. native destruction.<br> * The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}. + * <p>Visibility is set to false.</p> * <p> * This method invokes {@link Screen#removeReference()} after it's own destruction,<br> * which will issue {@link Screen#destroy()} if the reference count becomes 0.<br> diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 5c242d0e7..51a43d86c 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -159,16 +159,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if( null != newtChild ) { if(attach) { awtAdapter = new AWTParentWindowAdapter(newtChild).addTo(this); - if(newtChild.isValid()) { - newtChild.addWindowListener(clearAWTMenusOnNewtFocus); - } + newtChild.addWindowListener(clearAWTMenusOnNewtFocus); newtChild.setFocusAction(focusAction); // enable AWT focus traversal newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingProtocol.DO_NOTHING_ON_CLOSE); awtWindowClosingProtocol.addClosingListenerOneShot(); } else { - if(newtChild.isValid()) { - newtChild.removeWindowListener(clearAWTMenusOnNewtFocus); - } + newtChild.removeWindowListener(clearAWTMenusOnNewtFocus); newtChild.setFocusAction(null); newtChild.setDefaultCloseOperation(newtChildCloseOp); awtWindowClosingProtocol.removeClosingListener(); diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 638e4a462..bde4373d1 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -66,7 +66,7 @@ import com.jogamp.opengl.JoglVersion; * <p> */ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSCounter { - private WindowImpl window; + private final WindowImpl window; /** * Constructor. Do not call this directly -- use {@link #create()} instead. @@ -298,10 +298,6 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC window.setTopLevelSize(width, height); } - public final boolean isValid() { - return window.isValid(); - } - public final boolean isNativeValid() { return window.isNativeValid(); } @@ -511,28 +507,20 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC } public void display() { - display(false); - } - - public void display(boolean forceReshape) { - if( null == window ) { return; } - - if(sendDestroy || ( null!=window && window.hasDeviceChanged() && GLAutoDrawable.SCREEN_CHANGE_ACTION_ENABLED ) ) { + if( !isNativeValid() || !isVisible() ) { return; } + + if(sendDestroy || ( window.hasDeviceChanged() && GLAutoDrawable.SCREEN_CHANGE_ACTION_ENABLED ) ) { sendDestroy=false; destroy(); return; } - - if( null == context && isVisible() && 0<getWidth()*getHeight() ) { - // retry native window and drawable/context creation + + if( null == context && 0<getWidth()*getHeight() ) { // TODO: Check memory sync + // retry drawable and context creation setVisible(true); } - if(forceReshape) { - sendReshape = true; - } - - if( isVisible() && null != context ) { + if( null != context ) { // TODO: Check memory sync if( NativeSurface.LOCK_SURFACE_NOT_READY < lockSurface() ) { try { helper.invokeGL(drawable, context, displayAction, initAction); |