summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-03-14 17:22:22 +0100
committerSven Gothel <[email protected]>2013-03-14 17:22:22 +0100
commit538a41849192cc09da36eeaa5fa9ae10973d85b7 (patch)
treea9c13d13849bdb78d3f13e2a6fa1b9980a9c0021 /src/newt
parentdd705f1eb14b87b207e375ea0d71e00155a9933f (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/newt')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index dfaa55679..448b192a2 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1066,9 +1066,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(null==newParentWindowNEWT) {
throw new NativeWindowException("Reparenting with non NEWT Window type only available after it's realized: "+newParentWindow);
}
- // Destroy this window and use parent's Screen, while trying to preserve resources.
+ // Destroy this window and use parent's Screen.
// It may be created properly when the parent is made visible.
- destroy(true);
+ destroy(false);
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
} else if(newParentWindow != getParent()) {
@@ -1091,8 +1091,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
- // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources.
- destroy(true);
+ // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
+ destroy( wasVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
} else {
@@ -1121,8 +1121,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Already Top Window
operation = ReparentOperation.ACTION_NOP;
} else if( !isNativeValid() || forceDestroyCreate ) {
- // Destroy this window and mark it for [pending] creation, while trying to preserve resources.
- destroy(true);
+ // Destroy this window and mark it for [pending] creation.
+ // If isNativeValid() and becoming visible again - try to preserve resources, i.e. b/c on-/offscreen switch.
+ destroy( isNativeValid() && wasVisible );
if( 0 < width && 0 < height ) {
operation = ReparentOperation.ACTION_NATIVE_CREATION;
} else {
@@ -1225,11 +1226,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(!ok) {
- // native reparent failed -> try creation, while trying to preserve resources.
+ // native reparent failed -> try creation, while trying to preserve resources if becoming visible again.
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: native reparenting failed ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+" -> "+toHexString(newParentWindowHandle)+" - Trying recreation");
}
- destroy(true);
+ destroy( wasVisible );
operation = ReparentOperation.ACTION_NATIVE_CREATION ;
}
}