diff options
author | Sven Gothel <[email protected]> | 2013-12-11 05:25:31 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-12-11 05:25:31 +0100 |
commit | 45525950b0ad41b10790515c8b6142d746cd24f5 (patch) | |
tree | ff8ca25572f4d286795e53aa4aa592e952d15687 /src/newt/classes | |
parent | a00406f289ebaaae8d91e9ccc980829f202421a8 (diff) |
Bug 922 (2/2): NEWT Window.reparentWindow(..): Use REPARENT_HINT_BECOMES_VISIBLE to ensure GL State Preservation ; Add unit test !
Diffstat (limited to 'src/newt/classes')
4 files changed, 11 insertions, 10 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index d0ec8ae36..00c3f1eb7 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -867,7 +867,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } newtChild.setVisible(false); newtChild.setSize(w, h); - newtChild.reparentWindow(jawtWindow); + newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.addSurfaceUpdatedListener(jawtWindow); if( jawtWindow.isOffscreenLayerSurfaceEnabled() && 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) { @@ -917,7 +917,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto configureNewtChild(false); newtChild.setVisible(false); - newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer + newtChild.reparentWindow(null, -1, -1, 0 /* hint */); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer if(DEBUG) { System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this); 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 4a2878e3a..e6571d21a 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -42,6 +42,7 @@ import javax.media.opengl.GLPipelineFactory; import jogamp.newt.Debug; +import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; import com.jogamp.newt.event.MouseListener; @@ -218,7 +219,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { @Override public void run() { if( glWindow.isNativeValid() && null != awtParent && 0 != awtParent.getWindowHandle() ) { - glWindow.reparentWindow(awtParent); + glWindow.reparentWindow(awtParent, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); } } }).start(); @@ -308,7 +309,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop()); } else if(e.getKeyChar()=='r' && null!=awtParent) { if(null == glWindow.getParent()) { - glWindow.reparentWindow(awtParent); + glWindow.reparentWindow(awtParent, -1, -1, 0 /* hints */); } else { final InsetsImmutable insets = glWindow.getInsets(); final int x, y; @@ -320,7 +321,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { x = insets.getLeftWidth(); y = insets.getTopHeight(); } - glWindow.reparentWindow(null, x, y, false /* forceDestroyCreate */); + glWindow.reparentWindow(null, x, y, 0 /* hints */); glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE ); } } diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 5ed8d9e63..43e56c874 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -247,7 +247,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } configureNewtChild(false); newtChild.setVisible(false); - newtChild.reparentWindow(null); + newtChild.reparentWindow(null, -1, -1, 0 /* hint */); newtChild.destroy(); newtChild = null; } @@ -361,7 +361,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } newtChild.setSize(w, h); - newtChild.reparentWindow(nativeWindow); + newtChild.reparentWindow(nativeWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.setVisible(true); configureNewtChild(true); newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener @@ -372,7 +372,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } else { configureNewtChild(false); newtChild.setVisible(false); - newtChild.reparentWindow(null); + newtChild.reparentWindow(null, -1, -1, 0 /* hints */); } if(DEBUG) { System.err.println("NewtCanvasSWT.reparentWindow.X: add="+add+", win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index ae4cb9924..ed7dd5600 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2188,7 +2188,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // enable fullscreen on offscreen instance if(null != parentWindow) { nfs_parent = parentWindow; - reparentWindow(null, -1, -1, true /* forceDestroyCreate */); + reparentWindow(null, -1, -1, REPARENT_HINT_FORCE_RECREATION | REPARENT_HINT_BECOMES_VISIBLE); } else { throw new InternalError("Offscreen instance w/o parent unhandled"); } @@ -2198,7 +2198,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!fullScreenAction.fsOn() && null != nfs_parent) { // disable fullscreen on offscreen instance - reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */); + reparentWindow(nfs_parent, -1, -1, REPARENT_HINT_FORCE_RECREATION | REPARENT_HINT_BECOMES_VISIBLE); nfs_parent = null; } } |