From 4c3e9e258fae1161949dd14828c09f387bfd53d9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 22 Nov 2010 12:46:19 +0100 Subject: GLAnimatorControl pause()/resume() don't fail fast, return a boolean instead to simplify usage. --- src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/newt') diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index da22a6217..0f96facbd 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -89,11 +89,11 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { if (GLWindow.this.helper.isExternalAnimatorRunning()) { // Pause animations before initiating safe destroy. GLAnimatorControl ctrl = GLWindow.this.helper.getAnimator(); - ctrl.pause(); - + boolean isPaused = ctrl.pause(); destroy(); - - ctrl.resume(); + if(isPaused) { + ctrl.resume(); + } } else if (GLWindow.this.window.isSurfaceLockedByOtherThread()) { // Surface is locked by another thread // Flag that destroy should be performed on the next @@ -386,9 +386,8 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized boolean pauseRenderingAction() { boolean animatorPaused = false; GLAnimatorControl ctrl = GLWindow.this.getAnimator(); - if ( null!=ctrl && ctrl.isStarted() && !ctrl.isPaused()) { - animatorPaused = true; - ctrl.pause(); + if ( null!=ctrl ) { + animatorPaused = ctrl.pause(); } return animatorPaused; } -- cgit v1.2.3