aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java16
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java28
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java7
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java66
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java34
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java17
8 files changed, 74 insertions, 99 deletions
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index dbe51174e..44b4e7325 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -124,10 +124,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
// lazy native creation sequence: Display, Screen and Window
Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
- int wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
- Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -138,6 +134,8 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<1*durationPerTest) {
window.display();
@@ -154,11 +152,9 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
window.resetCounter();
Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
- wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<2*durationPerTest) {
@@ -190,10 +186,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
// recover Window
window.setVisible(true);
- wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
- Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -204,6 +196,8 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<1*durationPerTest) {
window.display();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java
index 9e0804a3d..7253b7353 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java
@@ -111,10 +111,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// lazy native creation sequence: Display, Screen and Window
Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
- int wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
- Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -126,6 +122,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<1*durationPerTest) {
window.display();
@@ -142,11 +140,9 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
window.resetCounter();
Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
- wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<2*durationPerTest) {
@@ -179,10 +175,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// recover Window
window.setVisible(true);
- wait=0;
- while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
- Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -194,6 +186,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<1*durationPerTest) {
window.display();
@@ -264,10 +258,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// lazy native creation sequence: Display, Screen and Window
Assert.assertEquals(0, window1.getTotalFrames());
window1.setVisible(true);
- int wait=0;
- while(wait<10 && window1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFrames());
- Assert.assertTrue(0 < window1.getTotalFrames());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(1,display.getReferenceCount());
@@ -278,13 +268,11 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window1.isNativeValid());
Assert.assertEquals(true,window1.isVisible());
+ System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFrames());
+ Assert.assertTrue(0 < window1.getTotalFrames());
Assert.assertEquals(0, window2.getTotalFrames());
window2.setVisible(true);
- wait=0;
- while(wait<10 && window2.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFrames());
- Assert.assertTrue(0 < window2.getTotalFrames());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(1,display.getReferenceCount());
@@ -295,6 +283,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window2.isNativeValid());
Assert.assertEquals(true,window2.isVisible());
+ System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFrames());
+ Assert.assertTrue(0 < window2.getTotalFrames());
while(window1.getDuration()<1*durationPerTest) {
window1.display();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
index 1002fc9f8..49591aab8 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -144,8 +144,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
frame1.setVisible(true);
Assert.assertTrue(AWTRobotUtil.toFront(robot, frame1));
- int wait=0;
- while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ Assert.assertTrue(glWindow1.isVisible());
System.out.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
index 3891f1565..af959a2eb 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -44,8 +44,6 @@ import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Iterator;
import javax.media.opengl.*;
@@ -164,9 +162,8 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
jFrame1.setVisible(true); // from here on, we need to run modifications on EDT
Assert.assertTrue(AWTRobotUtil.toFront(robot, jFrame1));
- int wait=0;
- while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames());
+ Assert.assertTrue(glWindow1.isVisible());
+ System.out.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
// Continuous animation ..
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index 112bb943c..279f2c370 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -99,8 +99,6 @@ public class TestGLWindows01NEWT extends UITestCase {
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
Assert.assertEquals(true,glWindow.isNativeValid());
- int wait=0;
- while(wait<10 && glWindow.getTotalFrames()<1) { Thread.sleep(100); wait++; }
System.out.println("Frames for initial setVisible(true): "+glWindow.getTotalFrames());
Assert.assertTrue(0 < glWindow.getTotalFrames());
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
index 91d8856f0..b9182dbaa 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -49,7 +49,7 @@ import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01NEWT extends UITestCase {
static int width, height;
static long durationPerTest = 500;
- static int frameWait = 2000;
+ static long waitAbout10FramesAt30fps = 10*34; // 10 frames @ 30fps
static GLCapabilities glCaps;
@BeforeClass
@@ -118,10 +118,6 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFrames());
Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
- int wait;
- for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
- Thread.sleep(100);
- }
System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
Assert.assertTrue(0 < glWindow2.getTotalFrames());
@@ -143,16 +139,12 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(false, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
- Assert.assertEquals(0, glWindow1.getTotalFrames());
glWindow1.resetCounter();
glWindow2.resetCounter();
Assert.assertEquals(0, glWindow1.getTotalFrames());
Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
- for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
- Thread.sleep(100);
- }
System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFrames()+", B2: "+glWindow2.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
Assert.assertTrue(0 < glWindow2.getTotalFrames());
@@ -200,9 +192,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, animator2.isAnimating());
Assert.assertEquals(false, animator2.isPaused());
Assert.assertNotNull(animator2.getThread());
- for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
- Thread.sleep(100);
- }
+ Thread.sleep(waitAbout10FramesAt30fps);
System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFrames()+", B4: "+glWindow2.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
Assert.assertTrue(0 < glWindow2.getTotalFrames());
@@ -262,18 +252,15 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFrames());
Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
- for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
- Thread.sleep(100);
- }
- System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFrames());
-
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
-
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+
+ System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
Assert.assertEquals(1,display.getReferenceCount());
Assert.assertEquals(true,display.isNativeValid());
Assert.assertNotNull(display.getEDTUtil());
@@ -369,11 +356,6 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFrames());
glWindow1.setVisible(true);
- int wait=0;
- while(wait<frameWait/100 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFrames());
-
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -381,13 +363,12 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(1,screen1.getReferenceCount());
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow2.setVisible(true);
- wait=0;
- while(wait<frameWait/100 && glWindow2.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFrames());
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -396,6 +377,9 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(2,screen1.getReferenceCount());
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
Animator animator1 = new Animator(glWindow1);
animator1.start();
@@ -414,12 +398,11 @@ public class TestParenting01NEWT extends UITestCase {
reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
System.err.println("Frames(2) "+glWindow2.getTotalFrames());
Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
- for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertSame(glWindow1,glWindow2.getParent());
+ System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -439,12 +422,11 @@ public class TestParenting01NEWT extends UITestCase {
reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
- for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParent());
+ System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -570,10 +552,6 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFrames());
Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
- int wait;
- for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
- Thread.sleep(100);
- }
System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertTrue(0 < glWindow1.getTotalFrames());
@@ -603,11 +581,10 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
- for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertNull(glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
@@ -617,11 +594,10 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
- for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
index d7504cfdf..73b13e326 100644
--- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
@@ -155,12 +155,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
}
public static interface LifecycleHook {
+ /**
+ * Reset of internal state counter, ie totalFrames, etc.
+ * Called from EDT while window is locked.
+ */
+ public abstract void resetCounter();
+
/**
* Invoked after Window setVisible,
* allows allocating resources depending on the native Window.
- * Called from EDT.
+ * Called from EDT while window is locked.
*/
- void setVisibleAction(boolean visible, boolean nativeWindowCreated);
+ void setVisibleActionPost(boolean visible, boolean nativeWindowCreated);
/**
* Invoked before Window destroy action,
@@ -174,7 +180,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
* Invoked before Window destroy action,
* allows releasing of resources depending on the native Window.<br>
* Surface locked.<br>
- * Called from EDT.
+ * Called from EDT while window is locked.
*/
void destroyActionInLock(boolean unrecoverable);
@@ -521,6 +527,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
String msg = new String("Window setVisible: START ("+getThreadName()+") "+x+"/"+y+" "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+" -> "+visible+", parentWindowHandle "+toHexString(WindowImpl.this.parentWindowHandle)+", parentWindow "+(null!=WindowImpl.this.parentWindow)/*+", "+this*/);
System.err.println(msg);
}
+
+ if(null!=lifecycleHook) {
+ lifecycleHook.resetCounter();
+ }
+
if(!visible && childWindows.size()>0) {
synchronized(childWindowsLock) {
for(int i = 0; i < childWindows.size(); i++ ) {
@@ -546,7 +557,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
}
if(null!=lifecycleHook) {
- lifecycleHook.setVisibleAction(visible, nativeWindowCreated);
+ lifecycleHook.setVisibleActionPost(visible, nativeWindowCreated);
}
if(0!=windowHandle && visible && childWindows.size()>0) {
@@ -565,6 +576,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
} finally {
windowLock.unlock();
}
+ if( getChanged() ) {
+ sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
+ }
}
}
@@ -576,9 +590,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
}
VisibleAction visibleAction = new VisibleAction(visible);
runOnEDTIfAvail(true, visibleAction);
- if( visibleAction.getChanged() ) {
- sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
- }
}
}
@@ -812,6 +823,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
System.err.println("Window.reparent: START ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate+", DEBUG_TEST_REPARENT_INCOMPATIBLE "+DEBUG_TEST_REPARENT_INCOMPATIBLE+" "+x+"/"+y+" "+width+"x"+height);
}
+ if(null!=lifecycleHook) {
+ lifecycleHook.resetCounter();
+ }
+
if(null!=newParentWindow) {
// reset position to 0/0 within parent space
x = 0;
@@ -1021,6 +1036,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
windowLock.unlock();
}
+ if( ACTION_NATIVE_REPARENTING == reparentAction ) {
+ sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
+ }
+
if( ACTION_NATIVE_CREATION == reparentAction && wasVisible ) {
// This may run on the Display/Screen connection,
// hence a new EDT task
@@ -1066,7 +1085,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
lifecycleHook.resumeRenderingAction();
}
}
- sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
}
return reparentActionStrategy;
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 2f5841b7e..f84c65cb7 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -330,9 +330,16 @@ public class GLWindow implements GLAutoDrawable, Window {
}
/** Window.LifecycleHook */
- public synchronized void setVisibleAction(boolean visible, boolean nativeWindowCreated) {
+ public synchronized void resetCounter() {
if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) {
- String msg = new String("GLWindow.setVisibleAction("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start");
+ System.err.println("GLWindow.resetCounter() "+Thread.currentThread());
+ }
+ GLWindow.this.resetCounter();
+ }
+
+ public synchronized void setVisibleActionPost(boolean visible, boolean nativeWindowCreated) {
+ if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) {
+ String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start");
System.err.println(msg);
// Exception e1 = new Exception(msg);
// e1.printStackTrace();
@@ -357,12 +364,9 @@ public class GLWindow implements GLAutoDrawable, Window {
}
drawable.setRealized(true);
context = drawable.createContext(null);
- resetCounter();
- } else if(!visible) {
- resetCounter();
}
if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) {
- String msg = new String("GLWindow.setVisibleAction("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin");
+ String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin");
System.err.println(msg);
//Exception e1 = new Exception(msg);
//e1.printStackTrace();
@@ -380,7 +384,6 @@ public class GLWindow implements GLAutoDrawable, Window {
}
public synchronized void resumeRenderingAction() {
- resetCounter();
GLAnimatorControl ctrl = GLWindow.this.getAnimator();
if ( null!=ctrl && animatorPaused ) {
animatorPaused = false;