diff options
author | Sven Gothel <[email protected]> | 2013-03-14 17:22:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-03-14 17:22:22 +0100 |
commit | 538a41849192cc09da36eeaa5fa9ae10973d85b7 (patch) | |
tree | a9c13d13849bdb78d3f13e2a6fa1b9980a9c0021 /src/jogl/classes | |
parent | dd705f1eb14b87b207e375ea0d71e00155a9933f (diff) |
Fix NEWT WindowImpl reparent-recreate w/ GLEventListenerState: Bug introduced w/ commit e2506d7663b752f00f0a98f793ebad52e65bd1e3
In case a reparent action takes place w/ recreate,
only preserve the GLEventListenerState if the window is valid and will become visible again (wasVisible).
Also add proper DEBUG log prefix to GLEventListenerState.
Diffstat (limited to 'src/jogl/classes')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java | 16 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java | 5 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java index ff250d27f..5b02e1fec 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java @@ -159,7 +159,7 @@ public class GLEventListenerState { final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities(); final AbstractGraphicsScreen aScreen2 = cloneScreen(aScreen1); if( DEBUG ) { - System.err.println("X00 NativeSurface: "+aSurface.getClass().getName()+", "+aSurface); + System.err.println("GLEventListenerState.moveFrom.0: "+aSurface.getClass().getName()+", "+aSurface); } aScreen1.getDevice().clearHandleOwner(); // don't close device handle @@ -172,7 +172,7 @@ public class GLEventListenerState { proxyOwnsUpstreamDevice = aProxy.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); final NativeSurface aUpSurface = aProxy.getUpstreamSurface(); if(DEBUG && null != aUpSurface) { - System.err.println("X00 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface); + System.err.println("GLEventListenerState.moveFrom.1: "+aUpSurface.getClass().getName()+", "+aUpSurface); } if(null != aUpSurface) { final AbstractGraphicsScreen aUpScreen1 = aUpSurface.getGraphicsConfiguration().getScreen(); @@ -181,8 +181,8 @@ public class GLEventListenerState { aUpScreen1.getDevice().clearHandleOwner(); // don't close device handle } if(DEBUG) { - System.err.println("X0X NativeSurface: "+aSurface.getClass().getName()+", "+aSurface); - System.err.println("X0X UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface); + System.err.println("GLEventListenerState.moveFrom.2: "+aSurface.getClass().getName()+", "+aSurface); + System.err.println("GLEventListenerState.moveFrom.3: "+aUpSurface.getClass().getName()+", "+aUpSurface); } } } else { @@ -256,13 +256,13 @@ public class GLEventListenerState { // Set new Screen and close previous one { if( DEBUG ) { - System.err.println("XX0 NativeSurface: "+aSurface.getClass().getName()+", "+aSurface); + System.err.println("GLEventListenerState.moveTo.0: "+aSurface.getClass().getName()+", "+aSurface); } final AbstractGraphicsScreen aScreen1 = aCfg.getScreen(); aCfg.setScreen( screen ); aScreen1.getDevice().close(); if( DEBUG ) { - System.err.println("XXX NativeSurface: "+aSurface.getClass().getName()+", "+aSurface); + System.err.println("GLEventListenerState.moveTo.1: "+aSurface.getClass().getName()+", "+aSurface); } } @@ -276,7 +276,7 @@ public class GLEventListenerState { final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration(); if( null != upstreamScreen ) { if( DEBUG ) { - System.err.println("XX0 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString()); + System.err.println("GLEventListenerState.moveTo.2: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString()); } aUpCfg.getScreen().getDevice().close(); aUpCfg.setScreen( upstreamScreen ); @@ -285,7 +285,7 @@ public class GLEventListenerState { } upstreamSet = true; if( DEBUG ) { - System.err.println("XXX UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString()); + System.err.println("GLEventListenerState.moveTo.3: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString()); } } else { throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true"); diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index e6652cfac..592607819 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -109,6 +109,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { * {@link #pullGLEventListenerState() pull} to preserve the {@link GLEventListenerState}. */ public final void setPreserveGLStateAtDestroy(boolean value) { + if( DEBUG ) { + System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+Thread.currentThread().getName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle())); + } preserveGLELSAtDestroy = value; } @@ -283,7 +286,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { */ protected void destroyImplInLock() { if( preserveGLELSAtDestroy ) { - preserveGLELSAtDestroy = false; + setPreserveGLStateAtDestroy(false); pullGLEventListenerState(); } if( null != context ) { |