aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-07 01:32:22 +0200
committerSven Gothel <[email protected]>2011-09-07 01:32:22 +0200
commite1ecd85a9d5877861cde35baababb298d1339898 (patch)
tree6606557af3995f026166b4d7bcf67c5b77a4e751 /src/test/com/jogamp
parent3766fc329ec27c09f7e71bbf705defc44a8bedac (diff)
NEWT/Window: Cleanup Actions: Reparenting, Fullscreen and Decoration
- don't assume size/pos change - hence don't set window's values, but wait for satisfaction - don't send resize events on our own, just rely on the event mechanism - fullscreen: don't wrap action around invisibility from Java, Win7 flashes otherwise. Clients who benefit from it (X11) impl. it natively. - fullscreen exit: validate pos/size in case of a child window, like reparenting. Otherwise the container might gets confused (eg. AWT).
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java29
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java3
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);