diff options
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java | 29 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java | 3 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java index e3cf132f6..75585291d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java @@ -29,6 +29,8 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.awt.Frame; +import javax.media.nativewindow.util.InsetsImmutable; + import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -49,16 +51,35 @@ class NewtAWTReparentingKeyAdapter extends KeyAdapter { if(e.getKeyChar()=='d') { glWindow.setUndecorated(!glWindow.isUndecorated()); } else if(e.getKeyChar()=='f') { - glWindow.setFullscreen(!glWindow.isFullscreen()); + glWindow.setFullscreen(!glWindow.isFullscreen()); + } else if(e.getKeyChar()=='p') { + new Thread() { + public void run() { + if(glWindow.getAnimator().isPaused()) { + glWindow.getAnimator().resume(); + } else { + glWindow.getAnimator().pause(); + } + } + }.run(); } else if(e.getKeyChar()=='r') { if(glWindow.getParent()==null) { System.err.println("XXX glWin to home"); glWindow.reparentWindow(newtCanvasAWT.getNativeWindow()); } else { - System.err.println("XXX glWin to TOP"); - glWindow.setUndecorated(false); + final InsetsImmutable nInsets = glWindow.getInsets(); + java.awt.Insets aInsets = frame.getInsets(); + System.err.println("XXX glWin to TOP - insets " + nInsets + ", " + aInsets); glWindow.reparentWindow(null); - glWindow.setTopLevelPosition(frame.getX()+frame.getWidth(), frame.getY()); + int dx, dy; + if(nInsets.getTotalHeight()==0) { + dx = aInsets.left; + dy = aInsets.top; + } else { + dx = nInsets.getLeftWidth(); + dy = nInsets.getTopHeight(); + } + glWindow.setPosition(frame.getX()+frame.getWidth()+dx, frame.getY()+dy); } glWindow.requestFocus(); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java index ec481d3a1..c7c067015 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java @@ -44,7 +44,6 @@ import javax.media.opengl.*; import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; -import com.jogamp.newt.event.*; import com.jogamp.newt.opengl.*; import com.jogamp.newt.awt.NewtCanvasAWT; @@ -74,7 +73,6 @@ public class TestParenting03bAWT extends UITestCase { Frame frame1 = new Frame("AWT Parent Frame"); GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setUpdateFPSFrames(1, null); - glWindow1.setUndecorated(true); NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(size); @@ -87,7 +85,6 @@ public class TestParenting03bAWT extends UITestCase { GLWindow glWindow2 = GLWindow.create(glCaps); glWindow2.setUpdateFPSFrames(1, null); - glWindow2.setUndecorated(true); NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); newtCanvasAWT2.setPreferredSize(size); |