aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-01-14 23:07:22 +0100
committerSven Gothel <[email protected]>2020-01-14 23:07:22 +0100
commitd92dc518eb891f2d125a8136efd6ed603d74a6e9 (patch)
tree890269678d66d5b5b4ace9c9fa4b00b0f4efb8a0
parent2cdf7730b6d3e813a8693087582f3cf3ac44f015 (diff)
Bug 1421: NEWT OSX Invisible: Refining child window visibility setting, commenting on child-window orderOut
Actual small change is to have child-NSWindow to use '[myWindow orderWindow: NSWindowAbove relativeTo:..' instead of 'orderFront' in creation and use the simple 'orderFront' to set a top-level NSWindow visible. Adding comment why we can't use 'orderOut' on child-NSWindow setting it invisible, this is due to OSX 10.7 changes and testing detaching the child-window from its parent causes havoc w/ SWT at least. Hence we only issue 'mWin orderWindow: NSWindowOut relativeTo:..]' and the result is having the child-NSWindow below the application. This in turn will make it visible again when moving the application around, as this child-NSWindow will no more follow the position. Suggestion is to have this 'fake invisible' child-NSWindow to be moved out of the overal viewport (all screens).
-rw-r--r--make/scripts/tests.sh6
-rw-r--r--src/newt/native/MacNewtNSWindow.m10
-rw-r--r--src/newt/native/MacWindow.m24
3 files changed, 31 insertions, 9 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 62edee2d4..a3d43b633 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -156,7 +156,7 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnativewindow.debug.SWT"
- D_ARGS="-Dnativewindow.debug.SWT -Dnewt.debug.Window -Djogl.debug.GLCanvas -Dnewt.debug.Window.MouseEvent"
+ D_ARGS="-Dnativewindow.debug.SWT -Dnewt.debug.Window -Djogl.debug.GLCanvas"
#D_ARGS="-Dnativewindow.debug.SWT -Dnativewindow.debug.X11Util -Dnewt.debug.Window"
#D_ARGS="-Dnativewindow.debug=all -Dnewt.debug.Window"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock"
@@ -492,7 +492,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $*
#testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT $*
-testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
+#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
#
@@ -795,7 +795,7 @@ testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasS
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
-#testswt com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs $*
+testswt com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testswt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $*
diff --git a/src/newt/native/MacNewtNSWindow.m b/src/newt/native/MacNewtNSWindow.m
index 6a2426950..ae2b4d748 100644
--- a/src/newt/native/MacNewtNSWindow.m
+++ b/src/newt/native/MacNewtNSWindow.m
@@ -1004,7 +1004,12 @@ NS_ENDHANDLER
- (void) attachToParent: (NSWindow*) parent
{
DBG_PRINT( "attachToParent.1\n");
+NS_DURING
+ // this causes troubles w/ SWT toolkit
+ // exception 'NSInvalidArgumentException', reason: '-[SWTCanvasView addChildWindow:ordered:]: unrecognized selector sent to instance 0x7fc198f66580'
[parent addChildWindow: self ordered: NSWindowAbove];
+NS_HANDLER
+NS_ENDHANDLER
DBG_PRINT( "attachToParent.2\n");
[self setParentWindow: parent];
DBG_PRINT( "attachToParent.X\n");
@@ -1016,7 +1021,12 @@ NS_ENDHANDLER
[self setParentWindow: nil];
if(NULL != parent) {
DBG_PRINT( "detachFromParent.2\n");
+NS_DURING
+ // this causes troubles w/ SWT toolkit
+ // exception 'NSInvalidArgumentException', reason: '-[SWTCanvasView removeChildWindow:]: unrecognized selector sent to instance 0x7fbb5cc65ed0'
[parent removeChildWindow: self];
+NS_HANDLER
+NS_ENDHANDLER
}
DBG_PRINT( "detachFromParent.X\n");
}
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index ee87ca4ad..b356649e7 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -925,7 +925,11 @@ NS_ENDHANDLER
if( visible ) {
#if 1
- [myWindow orderFront: myWindow];
+ if( NULL == parentWindow ) {
+ [myWindow orderFront: myWindow];
+ } else {
+ [myWindow orderWindow: NSWindowAbove relativeTo: [parentWindow windowNumber]];
+ }
// [myWindow performSelector:@selector(orderFront) withObject:myWindow afterDelay:0];
#elif 0
[myWindow makeKeyAndOrderFront: myWindow];
@@ -1237,7 +1241,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_resignFocus0
JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderFront0
(JNIEnv *env, jobject unused, jlong window)
{
- NSWindow* mWin = (NSWindow*) ((intptr_t) window);
+ NewtNSWindow* mWin = (NewtNSWindow*) (intptr_t) window;
if( NULL == mWin ) {
DBG_PRINT( "orderFront0 - NULL NEWT win - abort\n");
return;
@@ -1248,12 +1252,12 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderFront0
DBG_PRINT( "orderFront0 - window: (parent %p) %p visible %d (START)\n", pWin, mWin, [mWin isVisible]);
if( NULL == pWin ) {
- [mWin orderFrontRegardless];
+ [mWin orderFront: mWin];
} else {
[mWin orderWindow: NSWindowAbove relativeTo: [pWin windowNumber]];
}
- DBG_PRINT( "orderFront0 - window: (parent %p) %p (END)\n", pWin, mWin);
+ DBG_PRINT( "orderFront0 - window: (parent %p) %p visible %d (END)\n", pWin, mWin, [mWin isVisible]);
[pool release];
}
@@ -1266,7 +1270,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderFront0
JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderOut0
(JNIEnv *env, jobject unused, jlong window)
{
- NSWindow* mWin = (NSWindow*) ((intptr_t) window);
+ NewtNSWindow* mWin = (NewtNSWindow*) (intptr_t) window;
if( NULL == mWin ) {
DBG_PRINT( "orderOut0 - NULL NEWT win - abort\n");
return;
@@ -1276,13 +1280,21 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_orderOut0
DBG_PRINT( "orderOut0 - window: (parent %p) %p visible %d (START)\n", pWin, mWin, [mWin isVisible]);
+ // NSWindow - Child Windows Ordering Out
+ // For applications linked on 10.7 and later, ordering out a child window will now first remove itself from its parent window.
+ // Previously, ordering out a child window would implicitly order out the parent window too.
+ // https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#X10_7Notes
+ //
+ // '[mWin detachFromParent: pWin];' would cause serious troubles with other toolkits like SWT
+ // hence we only can move the window back!
if( NULL == pWin ) {
[mWin orderOut: mWin];
} else {
+ // NSWindowOut: The window is removed from the screen list and otherWin is ignored.
[mWin orderWindow: NSWindowOut relativeTo: [pWin windowNumber]];
}
- DBG_PRINT( "orderOut0 - window: (parent %p) %p (END)\n", pWin, mWin);
+ DBG_PRINT( "orderOut0 - window: (parent %p) %p visible %d (END)\n", pWin, mWin, [mWin isVisible]);
[pool release];
}