aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-23 16:59:27 +0100
committerSven Gothel <[email protected]>2013-11-23 16:59:27 +0100
commitfa1d211c9658ce209f411e559333da0e2fccd402 (patch)
treedd9c032beb2a2d55e285eb237c629b9829843462 /src/newt/classes/com
parent832a69834200f34a44d72639bfd47e73c72d2b42 (diff)
JOGLNewtAppletBase's add/remove 'reparentHome WindowListener' at start()/stop()
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index 2c4f25804..4a2878e3a 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -162,26 +162,6 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
public void init(ThreadGroup tg, final GLWindow glWindow) {
isValid = false;
this.glWindow = glWindow;
- this.glWindow.addWindowListener(new WindowAdapter() {
- // Closing action: back to parent!
- @Override
- public void windowDestroyNotify(WindowEvent e) {
- if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() &&
- null == glWindow.getParent() && null != awtParent && 0 != awtParent.getWindowHandle() )
- {
- Thread.dumpStack();
- // we may be called directly by the native EDT
- new Thread(new Runnable() {
- @Override
- public void run() {
- if( glWindow.isNativeValid() && null != awtParent && 0 != awtParent.getWindowHandle() ) {
- glWindow.reparentWindow(awtParent);
- }
- }
- }).start();
- }
- } } );
-
glEventListener = createInstance(glEventListenerClazzName);
if(null == glEventListener) {
return;
@@ -226,17 +206,38 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
isValid = true;
}
+ private final WindowListener reparentHomeListener = new WindowAdapter() {
+ // Closing action: back to parent!
+ @Override
+ public void windowDestroyNotify(WindowEvent e) {
+ if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() &&
+ null == glWindow.getParent() && null != awtParent && 0 != awtParent.getWindowHandle() )
+ {
+ // we may be called directly by the native EDT
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ if( glWindow.isNativeValid() && null != awtParent && 0 != awtParent.getWindowHandle() ) {
+ glWindow.reparentWindow(awtParent);
+ }
+ }
+ }).start();
+ }
+ } };
+
public void start() {
if(isValid) {
glWindow.setVisible(true);
glWindow.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED);
glAnimator.start();
awtParent = glWindow.getParent();
+ glWindow.addWindowListener(reparentHomeListener);
}
}
public void stop() {
if(null!=glAnimator) {
+ glWindow.removeWindowListener(reparentHomeListener);
glAnimator.stop();
glWindow.setVisible(false);
}