summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/newt/native/MacWindow.m20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java83
2 files changed, 91 insertions, 12 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 130b2e3e3..25ea47c47 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -1133,13 +1133,18 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderFront0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- NSWindow* win = (NSWindow*) ((intptr_t) window);
+ NSWindow* mWin = (NSWindow*) ((intptr_t) window);
+ NSWindow* pWin = [mWin parentWindow];
- DBG_PRINT( "orderFront0 - window: %p (START)\n", win);
+ DBG_PRINT( "orderFront0 - window: (parent %p) %p visible %d (START)\n", pWin, mWin, [mWin isVisible]);
- [win orderFrontRegardless];
+ if( NULL == pWin ) {
+ [mWin orderFrontRegardless];
+ } else {
+ [mWin orderWindow: NSWindowAbove relativeTo: [pWin windowNumber]];
+ }
- DBG_PRINT( "orderFront0 - window: %p (END)\n", win);
+ DBG_PRINT( "orderFront0 - window: (parent %p) %p (END)\n", pWin, mWin);
[pool release];
}
@@ -1155,14 +1160,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderOut0
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* mWin = (NSWindow*) ((intptr_t) window);
NSWindow* pWin = [mWin parentWindow];
- BOOL pWinVisible = NULL != pWin ? [pWin isVisible] : 0;
- DBG_PRINT( "orderOut0 - window: (parent %p visible %d) %p visible %d (START)\n", pWin, pWinVisible, mWin, [mWin isVisible]);
+ DBG_PRINT( "orderOut0 - window: (parent %p) %p visible %d (START)\n", pWin, mWin, [mWin isVisible]);
- if( NULL == pWin || !pWinVisible ) {
+ if( NULL == pWin ) {
[mWin orderOut: mWin];
} else {
- [mWin orderBack: mWin];
+ [mWin orderWindow: NSWindowOut relativeTo: [pWin windowNumber]];
}
DBG_PRINT( "orderOut0 - window: (parent %p) %p (END)\n", pWin, mWin);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 7beceb291..714c397f3 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -374,10 +374,28 @@ public class TestParenting01NEWT extends UITestCase {
int state = 0;
Window.ReparentOperation reparentAction;
- while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) {
+ while(animator1.isAnimating() && animator1.getTotalFPSDuration()<7*durationPerTest) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
+ // top-level glWindow2 hide
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ glWindow2.setVisible(false);
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 1:
+ // top-level glWindow2 show
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ glWindow2.setVisible(true);
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 2:
// glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
System.err.println("Frames(1) "+glWindow2.getTotalFPSFrames());
@@ -403,7 +421,25 @@ public class TestParenting01NEWT extends UITestCase {
break;
- case 1:
+ case 3:
+ // child glWindow2 hide
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ glWindow2.setVisible(false);
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 4:
+ // child glWindow2 show
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ glWindow2.setVisible(true);
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 5:
// glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
@@ -566,10 +602,29 @@ public class TestParenting01NEWT extends UITestCase {
int state = 0;
Window.ReparentOperation reparentAction;
- while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) {
+ while(animator1.isAnimating() && animator1.getTotalFPSDuration()<7*durationPerTest) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
+ // child glWindow2 hide
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ glWindow2.setVisible(false);
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 1:
+ // child glWindow2 show
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ glWindow2.setVisible(true);
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 2:
+ // glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
@@ -584,7 +639,27 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
break;
- case 1:
+
+ case 3:
+ // top-level glWindow2 hide
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ glWindow2.setVisible(false);
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 4:
+ // top-level glWindow2 show
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ glWindow2.setVisible(true);
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow1.isVisible());
+ break;
+
+ case 5:
+ // glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);