From b2c27c8edc2e9516a5341332a3480485d72eb6af Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 14 Mar 2009 05:22:19 +0000 Subject: NEWT window closing: - New WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY and WindowListener.windowDestroyNotify() method. - Removed windowClosed() method for JNI hook - Added windowDestroyNotify() windowDestroyed(), where windowDestroyNotify() shall be called by the native implementation _before_ the window gets shutdown. The Window.java then sends a WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY event, and either Window.java or it's owner GLWindow.java issues the destroy() procedure. - Added GLEventListener.dispose(GLAutoDrawable), to allow user application to release GL ressources. Issued by GLWindow (-> see windowDestroyNotify()) - X11 impl intercepts WM_DELETE_WINDOW, using Atom, MacosX impl already uses the _before_ method (VERIFY), and Windows impl uses the WM_CLOSE event (VERIFY). JOGL2 dispose/destroy .. - Added GLEventListener.dispose() to GLCanvas and GLJpanel - GL* toString() rearrangement, assumes it is issued by GLContext(), which indeed is the core information node. - Added proper destroy() methods and calls, to achieve a proper resource release at destruction. Instrumentizing almost all classes with a destroy() method, so no release function lookup is necessary. - misc changes .. JOGL2 Demos - Fixed in regards to the above changes git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@321 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/es1/cube/CubeImmModeSink.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/demos/es1/cube/CubeImmModeSink.java') diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index c7536d2..235d376 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -43,6 +43,8 @@ import java.nio.*; import com.sun.javafx.newt.*; public class CubeImmModeSink implements GLEventListener { + boolean quit = false; + public CubeImmModeSink () { this(false, false); } @@ -256,6 +258,10 @@ public class CubeImmModeSink implements GLEventListener { // weird effect ..: gl.glCullFace(gl.GL_FRONT); } + public void dispose(GLAutoDrawable drawable) { + quit=true; + } + public void display(GLAutoDrawable drawable) { GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); GL2ES1 gl2es1=null; @@ -425,12 +431,12 @@ public class CubeImmModeSink implements GLEventListener { long curTime; long startTime = System.currentTimeMillis(); - while (((curTime = System.currentTimeMillis()) - startTime) < 31000) { + while (!quit && ((curTime = System.currentTimeMillis()) - startTime) < 31000) { window.display(); } // Shut things down cooperatively - window.close(); + window.destroy(); window.getFactory().shutdown(); System.out.println("CubeImmModeSink shut down cleanly."); } catch (Throwable t) { -- cgit v1.2.3