aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-27 16:39:20 +0200
committerSven Gothel <[email protected]>2010-10-27 16:39:20 +0200
commite6225fce71daa90a2a2b631550ba048c2a84ff25 (patch)
tree863985817e72b5b9fc855de3be4f2154fa86dedf /src/newt
parente6131c6b2cbf8d1e5a05f0343612f5083b55aaa9 (diff)
WindowImpl/GLWindow LifecycleHook:
- 'destroyAction' -> 'destroyActionPreLock' 'destroyActionInLock', to be able to stop animation before locking. GLDrawableHelper.invokeGL() dispose case (initAction == null): - pause animator if animating before makeCurrent (locking) GLCanvas/GLJPanel dispose: recreate case - resume animator if was animating
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java18
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java12
2 files changed, 26 insertions, 4 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
index f9383ea38..0eb8f9644 100644
--- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
@@ -149,10 +149,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
/**
* Invoked before Window destroy action,
- * allows releasing of resources depending on the native Window.
+ * allows releasing of resources depending on the native Window.<br>
+ * Surface not locked yet.<br>
+ * Called not necessarily from EDT.
+ */
+ void destroyActionPreLock(boolean unrecoverable);
+
+ /**
+ * Invoked before Window destroy action,
+ * allows releasing of resources depending on the native Window.<br>
+ * Surface locked.<br>
* Called from EDT.
*/
- void destroyAction(boolean unrecoverable);
+ void destroyActionInLock(boolean unrecoverable);
/** Only informal, when starting reparenting */
void reparentActionPre();
@@ -640,7 +649,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
}
if(null!=lifecycleHook) {
- lifecycleHook.destroyAction(unrecoverable);
+ lifecycleHook.destroyActionInLock(unrecoverable);
}
// Now us ..
@@ -680,6 +689,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
//Exception ee = new Exception(msg);
//ee.printStackTrace();
}
+ if(null!=lifecycleHook) {
+ lifecycleHook.destroyActionPreLock(unrecoverable);
+ }
DestroyAction destroyAction = new DestroyAction(unrecoverable);
runOnEDTIfAvail(true, destroyAction);
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index aef4de92a..f6901e54a 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -278,7 +278,17 @@ public class GLWindow implements GLAutoDrawable, Window {
DisposeAction disposeAction = new DisposeAction();
/** Window.LifecycleHook */
- public synchronized void destroyAction(boolean unrecoverable) {
+ public synchronized void destroyActionPreLock(boolean unrecoverable) {
+ GLAnimatorControl animator = GLWindow.this.getAnimator();
+ // since we have no 'recreation model' for dispose here yet,
+ // we simply stop the animator if started.
+ if(null!=animator && animator.isStarted()) {
+ animator.stop();
+ }
+ }
+
+ /** Window.LifecycleHook */
+ public synchronized void destroyActionInLock(boolean unrecoverable) {
if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) {
String msg = new String("GLWindow.destroy("+unrecoverable+") "+Thread.currentThread()+", start");
System.err.println(msg);