diff options
Diffstat (limited to 'src/newt/native')
-rw-r--r-- | src/newt/native/MacWindow.m | 55 | ||||
-rw-r--r-- | src/newt/native/NewtMacWindow.h | 2 | ||||
-rw-r--r-- | src/newt/native/NewtMacWindow.m | 14 |
3 files changed, 20 insertions, 51 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index ccd907c25..ee012add3 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -853,16 +853,16 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getDisplayID0 */ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initWindow0 (JNIEnv *env, jobject jthis, jlong parent, jlong window, jint x, jint y, jint w, jint h, jfloat reqPixelScale, - jboolean opaque, jboolean visible, jlong jview) + jboolean opaque, jboolean atop, jboolean abottom, jboolean visible, jlong jview) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NewtMacWindow* myWindow = (NewtMacWindow*) ((intptr_t) window); NewtView* myView = (NewtView*) (intptr_t) jview ; BOOL fullscreen = myWindow->isFullscreenWindow; - DBG_PRINT( "initWindow0 - %p (this), %p (parent), %p (window), %d/%d %dx%d, reqPixScale %f, opaque %d, fs %d, visible %d, view %p (START)\n", + DBG_PRINT( "initWindow0 - %p (this), %p (parent), %p (window), %d/%d %dx%d, reqPixScale %f, opaque %d, atop %d, abottom %d, fs %d, visible %d, view %p (START)\n", (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, (int)x, (int)y, (int)w, (int)h, (float)reqPixelScale, - (int) opaque, (int)fullscreen, (int)visible, myView); + (int) opaque, (int)atop, (int)abottom, (int)fullscreen, (int)visible, myView); NS_DURING // HiDPI scaling: Setup - Available >= 10.7 @@ -925,6 +925,7 @@ NS_ENDHANDLER [myWindow setOpaque: NO]; [myWindow setBackgroundColor: [NSColor clearColor]]; } + [myWindow setAlwaysOn: atop bottom:abottom]; // specify we want mouse-moved events [myWindow setAcceptsMouseMovedEvents:YES]; @@ -1466,54 +1467,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setWindowClie /* * Class: jogamp_newt_driver_macosx_WindowDriver - * Method: setAlwaysOnTop0 - * Signature: (JZ)V - */ -JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTop0 - (JNIEnv *env, jobject unused, jlong window, jboolean atop) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSWindow* win = (NSWindow*) ((intptr_t) window); - - DBG_PRINT( "setAlwaysOnTop0 - window: %p, atop %d (START)\n", win, (int)atop); - - if(atop) { - [win setLevel:NSFloatingWindowLevel]; - } else { - [win setLevel:NSNormalWindowLevel]; - } - - DBG_PRINT( "setAlwaysOnTop0 - window: %p, atop %d (END)\n", win, (int)atop); - - [pool release]; -} - -/* - * Class: jogamp_newt_driver_macosx_WindowDriver - * Method: setAlwaysOnBottom0 - * Signature: (JZ)V - */ -JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnBottom0 - (JNIEnv *env, jobject unused, jlong window, jboolean abottom) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSWindow* win = (NSWindow*) ((intptr_t) window); - - DBG_PRINT( "setAlwaysOnBottom0 - window: %p, abottom %d (START)\n", win, (int)abottom); - - if(abottom) { - [win setLevel:NSScreenSaverWindowLevel]; // ?? - } else { - [win setLevel:NSNormalWindowLevel]; - } - - DBG_PRINT( "setAlwaysOnBottom0 - window: %p, abottom %d (END)\n", win, (int)abottom); - - [pool release]; -} - -/* - * Class: jogamp_newt_driver_macosx_WindowDriver * Method: getLocationOnScreen0 * Signature: (JII)Lcom/jogamp/nativewindow/util/Point; */ diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h index 151eb0797..bd088784a 100644 --- a/src/newt/native/NewtMacWindow.h +++ b/src/newt/native/NewtMacWindow.h @@ -164,6 +164,8 @@ CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen); - (void) setRealized: (BOOL)v; - (BOOL) isRealized; +- (void) setAlwaysOn: (BOOL)top bottom:(BOOL)bottom; + - (void) updateInsets: (JNIEnv*) env jwin: (jobject) javaWin; - (void) updateSizePosInsets: (JNIEnv*) env jwin: (jobject) javaWin defer: (jboolean)defer; - (void) attachToParent: (NSWindow*) parent; diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m index 70dc5969b..86c4490ed 100644 --- a/src/newt/native/NewtMacWindow.m +++ b/src/newt/native/NewtMacWindow.m @@ -932,6 +932,20 @@ NS_ENDHANDLER return realized; } +- (void) setAlwaysOn: (BOOL)top bottom:(BOOL)bottom +{ + if( top ) { + DBG_PRINT( "*************** setAlwaysOn -> top\n"); + [self setLevel: kCGMaximumWindowLevel]; + } else if ( bottom ) { + DBG_PRINT( "*************** setAlwaysOn -> bottom\n"); + [self setLevel: kCGDesktopIconWindowLevel]; // w/ input + } else { + DBG_PRINT( "*************** setAlwaysOn -> normal\n"); + [self setLevel:NSNormalWindowLevel]; + } +} + - (void) updateInsets: (JNIEnv*) env jwin: (jobject) javaWin { NSRect frameRect = [self frame]; |