diff options
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java | 14 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java | 71 | ||||
-rw-r--r-- | src/newt/native/IOSWindow.m | 2 | ||||
-rw-r--r-- | src/newt/native/MacNewtNSWindow.m | 5 | ||||
-rw-r--r-- | src/newt/native/MacWindow.m | 219 |
5 files changed, 152 insertions, 159 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java index d8ec75c36..b7ecc23d6 100644 --- a/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/ios/WindowDriver.java @@ -756,8 +756,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl !offscreenInstance && 0 != ( STATE_MASK_ALWAYSONBOTTOM & flags), !offscreenInstance && 0 != ( STATE_MASK_VISIBLE & flags), surfaceHandle); - final long uiView = IOSUtil.GetUIView(newWin[0], true); - surfaceHandle = uiView; + surfaceHandle = IOSUtil.GetUIView(newWin[0], true); if( offscreenInstance ) { orderOut0(0!=parentWinHandle ? parentWinHandle : newWin[0]); @@ -770,6 +769,17 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this); } setWindowHandle( newWin[0] ); + /** + * TODO: Validate whether visibility shall also be handled async on IOS as on OSX + if( !offscreenInstance && 0 != ( STATE_MASK_VISIBLE & flags) ) { + IOSUtil.RunOnMainThread(false, false, new Runnable() { + @Override + public void run() { + orderFront0( newWin[0] ); + } + + }); + } */ } catch (final Exception ie) { ie.printStackTrace(); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index 1c6102f88..937c11a5c 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -733,37 +733,27 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl final int flags) { final long parentWinHandle = getParentWindowHandle(); - final long preWinHandle = getWindowHandle(); + final long oldWinHandle = getWindowHandle(); if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+ ": offscreen "+offscreenInstance+", recreate "+recreate+ ", pS "+pS+", "+width+"x"+height+", state "+getReconfigStateMaskString(flags)+ - ", preWinHandle "+toHexString(preWinHandle)+", parentWin "+toHexString(parentWinHandle)+ + ", preWinHandle "+toHexString(oldWinHandle)+", parentWin "+toHexString(parentWinHandle)+ ", surfaceHandle "+toHexString(surfaceHandle)); // Thread.dumpStack(); } try { - if( 0 != preWinHandle ) { + if( 0 != oldWinHandle ) { setWindowHandle(0); if( 0 == surfaceHandle ) { throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView"); } - OSXUtil.RunOnMainThread(false, false /* kickNSApp */, new Runnable() { - @Override - public void run() { - changeContentView0(parentWinHandle, preWinHandle, 0); - close0( preWinHandle ); - } }); } else { if( 0 != surfaceHandle ) { throw new NativeWindowException("Internal Error - create w/o window, but has Newt NSView"); } - surfaceHandle = createView0(pS.getX(), pS.getY(), width, height); - if( 0 == surfaceHandle ) { - throw new NativeWindowException("Could not create native view "+Thread.currentThread().getName()+" "+this); - } } final int windowStyle; @@ -784,41 +774,54 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl OSXUtil.RunOnMainThread(true, false /* kickNSApp */, new Runnable() { @Override public void run() { - newWin[0] = createWindow0( pS.getX(), pS.getY(), width, height, + /** + * Does everything at once, same as original code path: + * 1) if oldWinHandle: changeContentView (detaching view) + close0(oldWindHandle) + * 2) create new window + * 3) create new view if previous didn't exist (oldWinHandle) + * 4) changeContentView (attaching view) etc .. + */ + final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance; + newWin[0] = createWindow1( oldWinHandle, parentWinHandle, pS.getX(), pS.getY(), width, height, reqPixelScale[0] /* HiDPI uniformPixelScale */, 0 != ( STATE_MASK_FULLSCREEN & flags), - windowStyle, - NSBackingStoreBuffered, surfaceHandle); - if ( newWin[0] != 0 ) { - final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance; - initWindow0( parentWinHandle, newWin[0], pS.getX(), pS.getY(), width, height, reqPixelScale[0] /* HiDPI uniformPixelScale */, - isOpaque, - !offscreenInstance && 0 != ( STATE_MASK_ALWAYSONTOP & flags), - !offscreenInstance && 0 != ( STATE_MASK_ALWAYSONBOTTOM & flags), - !offscreenInstance && 0 != ( STATE_MASK_VISIBLE & flags), - surfaceHandle); - if( offscreenInstance ) { - orderOut0(0!=parentWinHandle ? parentWinHandle : newWin[0]); - } else { - setTitle0(newWin[0], getTitle()); - } + windowStyle, NSBackingStoreBuffered, + isOpaque, + !offscreenInstance && 0 != ( STATE_MASK_ALWAYSONTOP & flags), + !offscreenInstance && 0 != ( STATE_MASK_ALWAYSONBOTTOM & flags), + !offscreenInstance && 0 != ( STATE_MASK_VISIBLE & flags), + surfaceHandle); + surfaceHandle = OSXUtil.GetNSView(newWin[0]); + + if( offscreenInstance ) { + orderOut0(0!=parentWinHandle ? parentWinHandle : newWin[0]); + } else { + setTitle0(newWin[0], getTitle()); } } }); - if ( newWin[0] == 0 ) { + if ( newWin[0] == 0 || 0 == surfaceHandle ) { throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this); } setWindowHandle( newWin[0] ); + if( !offscreenInstance && 0 != ( STATE_MASK_VISIBLE & flags) ) { + OSXUtil.RunOnMainThread(false, false, new Runnable() { + @Override + public void run() { + orderFront0( newWin[0] ); + } + + }); + } } catch (final Exception ie) { ie.printStackTrace(); } } protected static native boolean initIDs0(); - private native long createView0(int x, int y, int w, int h); - private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view); /** Must be called on Main-Thread */ - private native void initWindow0(long parentWindow, long window, int x, int y, int w, int h, float reqPixelScale, - boolean opaque, boolean atop, boolean abottom, boolean visible, long view); + private native long createWindow1(long oldWindow, long parentWindow, int x, int y, int w, int h, float reqPixelScale, + boolean fullscreen, int windowStyle, int backingStoreType, + boolean opaque, boolean atop, boolean abottom, boolean visible, long view); private native int getDisplayID0(long window); private native void setPixelScale0(long window, long view, float reqPixelScale); diff --git a/src/newt/native/IOSWindow.m b/src/newt/native/IOSWindow.m index b953c3146..9bc72c1ec 100644 --- a/src/newt/native/IOSWindow.m +++ b/src/newt/native/IOSWindow.m @@ -533,8 +533,8 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_ios_WindowDriver_createWindow1 } DBG_PRINT( "createWindow1.1 - window %p, isHidden %d, rootViewController %p\n", myWindow, [myWindow isHidden], myWindow.rootViewController); - CGRect rectView = CGRectMake(0, 0, w, h); if( NULL == myView ) { + CGRect rectView = CGRectMake(0, 0, w, h); myView = [[NewtUIView alloc] initWithFrame: rectView] ; } CAEAGLLayer* l = (CAEAGLLayer*)[myView layer]; diff --git a/src/newt/native/MacNewtNSWindow.m b/src/newt/native/MacNewtNSWindow.m index 96dff76f6..e75890349 100644 --- a/src/newt/native/MacNewtNSWindow.m +++ b/src/newt/native/MacNewtNSWindow.m @@ -898,8 +898,9 @@ NS_ENDHANDLER realized = YES; withinLiveResize = JNI_FALSE; - DBG_PRINT("NewtWindow::create: %p, realized %d, hasPresentationSwitch %d[defaultOptions 0x%X, fullscreenOptions 0x%X], (refcnt %d)\n", - res, realized, (int)hasPresentationSwitch, (int)defaultPresentationOptions, (int)fullscreenPresentationOptions, (int)[res retainCount]); + DBG_PRINT("NewtWindow::create: %p, realized %d, hasPresentationSwitch %d[defaultOptions 0x%X, fullscreenOptions 0x%X], view %p (refcnt %d)\n", + res, realized, (int)hasPresentationSwitch, (int)defaultPresentationOptions, (int)fullscreenPresentationOptions, + (void *)[self contentView], (int)[res retainCount]); return res; } diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index c1fcdf51e..ffbdc3622 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -41,6 +41,7 @@ #import "KeyEvent.h" #import "ScreenMode.h" +#import <QuartzCore/QuartzCore.h> #import <ApplicationServices/ApplicationServices.h> #import <stdio.h> @@ -771,99 +772,67 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initIDs0 } /** - * Class: jogamp_newt_driver_macosx_WindowDriver - * Method: createView0 - * Signature: (IIII)J + * Class: jogamp_newt_driver_ios_WindowDriver + * Method: createWindow1 + * Signature: (JJIIIIFZZZZJ)J */ -JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createView0 - (JNIEnv *env, jobject jthis, jint x, jint y, jint w, jint h) +JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createWindow1 + (JNIEnv *env, jobject jthis, jlong joldwin, jlong jparent, jint x, jint y, jint w, jint h, jfloat reqPixelScale, + jboolean fullscreen, jint styleMask, jint bufferingType, + jboolean opaque, jboolean atop, jboolean abottom, jboolean visible, jlong jview) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + // [CATransaction begin]; - DBG_PRINT( "createView0 - %p (this), %d/%d %dx%d (START)\n", - (void*)(intptr_t)jthis, (int)x, (int)y, (int)w, (int)h); - - NSRect rectView = NSMakeRect(0, 0, w, h); - NewtNSView *myView = [[NewtNSView alloc] initWithFrame: rectView] ; - DBG_PRINT( "createView0.X - new view: %p\n", myView); - - [pool release]; - - return (jlong) (intptr_t) myView; -} - -/** - * Method creates a deferred un-initialized Window, hence no special invocation required inside method. - * - * Class: jogamp_newt_driver_macosx_WindowDriver - * Method: createWindow0 - * Signature: (IIIIZIIJ)J - */ -JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createWindow0 - (JNIEnv *env, jobject jthis, jint x, jint y, jint w, jint h, - jboolean fullscreen, jint styleMask, jint bufferingType, jlong jview) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NewtNSWindow* oldWindow = (NewtNSWindow*) (intptr_t) joldwin ; NewtNSView* myView = (NewtNSView*) (intptr_t) jview ; - DBG_PRINT( "createWindow0 - %p (this), %d/%d %dx%d, fs %d, style %X, buffType %X, view %p (START)\n", - (void*)(intptr_t)jthis, (int)x, (int)y, (int)w, (int)h, (int)fullscreen, - (int)styleMask, (int)bufferingType, myView); - (void)myView; + NSObject* nsParentObj = (NSObject*) ((intptr_t) jparent); + NSWindow* parentWindow = NULL; + NSView* parentView = NULL; + if( nsParentObj != NULL && [nsParentObj isKindOfClass:[NSWindow class]] ) { + parentWindow = (NSWindow*) nsParentObj; + parentView = [parentWindow contentView]; + DBG_PRINT( "createWindow1 - Parent is NSWindow : %p (win) -> %p (view) \n", parentWindow, parentView); + } else if( nsParentObj != NULL && [nsParentObj isKindOfClass:[NSView class]] ) { + parentView = (NSView*) nsParentObj; + parentWindow = [parentView window]; + DBG_PRINT( "createWindow1 - Parent is NSView : %p -(view) > %p (win) \n", parentView, parentWindow); + } else { + DBG_PRINT( "createWindow1 - Parent is neither NSWindow nor NSView : %p\n", nsParentObj); + } + DBG_PRINT( "createWindow1.0 - %p (this), oldWin %p, parent(win %p, view %p), myView %p, %d/%d %dx%d, reqPixelScale %f, fullscreen %d, opaque %d, atop %d, abottom %d, visible %d (START)\n", + (void*)(intptr_t)jthis, oldWindow, parentWindow, parentView, myView, (int)x, (int)y, (int)w, (int)h, (float)reqPixelScale, + fullscreen, opaque, atop, abottom, visible); + + if( NULL != oldWindow ) { + if( NULL == myView ) { + NewtCommon_throwNewRuntimeException(env, "oldWindow %p given but no view %p (this %p)", oldWindow, myView, (void*)(intptr_t)jthis); + } + changeContentView(env, jthis, parentView, oldWindow, NULL, NO); + Java_jogamp_newt_driver_macosx_WindowDriver_close0(env, NULL, joldwin); + } else if( NULL != myView ) { + NewtCommon_throwNewRuntimeException(env, "view %p given but no oldWindow %p (this %p)", oldWindow, myView, (void*)(intptr_t)jthis); + } if (fullscreen) { styleMask = NSBorderlessWindowMask; } NSRect rectWin = NSMakeRect(x, y, w, h); - - // Allocate the window NewtNSWindow* myWindow = [[NewtNSWindow alloc] initWithContentRect: rectWin styleMask: (NSUInteger) styleMask backing: (NSBackingStoreType) bufferingType defer: YES isFullscreenWindow: fullscreen]; - // DBG_PRINT( "createWindow0.1 - %p, isVisible %d\n", myWindow, [myWindow isVisible]); - - DBG_PRINT( "createWindow0.X - %p, isVisible %d\n", myWindow, [myWindow isVisible]); - - [pool release]; - - return (jlong) ((intptr_t) myWindow); -} +#ifdef VERBOSE_ON + int dbgIdx = 1; +#endif + DBG_PRINT( "createWindow1.%d - %p, isVisible %d\n", dbgIdx++, myWindow, [myWindow isVisible]); -JNIEXPORT jint JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getDisplayID0(JNIEnv *env, jobject jthis, jlong window) { - NewtNSWindow* myWindow = (NewtNSWindow*) ((intptr_t) window); - if( NULL == myWindow ) { - DBG_PRINT( "getDisplayID0 - NULL NEWT win - abort\n"); - return 0; + if( NULL == myView ) { + NSRect rectView = NSMakeRect(0, 0, w, h); + myView = [[NewtNSView alloc] initWithFrame: rectView] ; } - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSScreen *screen = [myWindow screen]; - int32_t displayID = (int32_t)NewtScreen_getCGDirectDisplayIDByNSScreen(screen); - [pool release]; - return (jint) displayID; -} - -/** - * Method is called on Main-Thread, hence no special invocation required inside method. - * - * Class: jogamp_newt_driver_macosx_WindowDriver - * Method: initWindow0 - * Signature: (JJIIIIFZZZJ)V - */ -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 atop, jboolean abottom, jboolean visible, jlong jview) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NewtNSWindow* myWindow = (NewtNSWindow*) ((intptr_t) window); - NewtNSView* myView = (NewtNSView*) (intptr_t) jview ; - BOOL fullscreen = myWindow->isFullscreenWindow; - - 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)atop, (int)abottom, (int)fullscreen, (int)visible, myView); - NS_DURING // HiDPI scaling: Setup - Available >= 10.7 if( 1.0 == reqPixelScale ) { @@ -884,22 +853,6 @@ NS_DURING NS_HANDLER NS_ENDHANDLER - NSObject* nsParentObj = (NSObject*) ((intptr_t) parent); - NSWindow* parentWindow = NULL; - NSView* parentView = NULL; - if( nsParentObj != NULL && [nsParentObj isKindOfClass:[NSWindow class]] ) { - parentWindow = (NSWindow*) nsParentObj; - parentView = [parentWindow contentView]; - DBG_PRINT( "initWindow0 - Parent is NSWindow : %p (win) -> %p (view) \n", parentWindow, parentView); - } else if( nsParentObj != NULL && [nsParentObj isKindOfClass:[NSView class]] ) { - parentView = (NSView*) nsParentObj; - parentWindow = [parentView window]; - DBG_PRINT( "initWindow0 - Parent is NSView : %p -(view) > %p (win) \n", parentView, parentWindow); - } else { - DBG_PRINT( "initWindow0 - Parent is neither NSWindow nor NSView : %p\n", nsParentObj); - } - DBG_PRINT( "initWindow0 - is visible.1: %d\n", [myWindow isVisible]); - // Remove animations for child windows if(NULL != parentWindow) { NS_DURING @@ -911,46 +864,44 @@ NS_HANDLER NS_ENDHANDLER } -#ifdef VERBOSE_ON - int dbgIdx = 1; -#endif + DBG_PRINT( "createWindow1.%d\n", dbgIdx++); if(opaque) { [myWindow setOpaque: YES]; - DBG_PRINT( "initWindow0.%d\n", dbgIdx++); if (!fullscreen) { [myWindow setShowsResizeIndicator: YES]; } - DBG_PRINT( "initWindow0.%d\n", dbgIdx++); } else { [myWindow setOpaque: NO]; [myWindow setBackgroundColor: [NSColor clearColor]]; } + DBG_PRINT( "createWindow1.%d\n", dbgIdx++); + [myWindow setAlwaysOn: atop bottom:abottom]; // specify we want mouse-moved events [myWindow setAcceptsMouseMovedEvents:YES]; - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); // Set the content view changeContentView(env, jthis, parentView, myWindow, myView, NO); [myWindow setInitialFirstResponder: myView]; - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); if(NULL!=parentWindow) { [myWindow attachToParent: parentWindow]; } - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d, visible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d, visible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible], visible); // Immediately re-position this window based on an upper-left coordinate system setWindowClientTopLeftPointAndSize(myWindow, x, y, w, h, NO); - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); NS_DURING @@ -960,7 +911,7 @@ NS_DURING [myWindow setAllowsConcurrentViewDrawing: YES]; } - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); if ( [myView respondsToSelector:@selector(setCanDrawConcurrently:)] ) { @@ -969,15 +920,32 @@ NS_DURING NS_HANDLER NS_ENDHANDLER - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); - // visible on front +#if 0 + // Visible on front may lead to a deadlock on Java11 + // WindowDriver's createWindow1 caller shall issue this w/o wait + // after creation if( visible ) { - [myWindow orderFront: myWindow]; + #if 0 + [myWindow makeKeyAndOrderFront: myWindow]; + if( NULL != parentWindow ) { + [myWindow orderWindow: NSWindowAbove relativeTo: [parentWindow windowNumber]]; + } + #endif + #if 1 + [myView setNextResponder: myWindow]; + if( NULL == parentWindow ) { + [myWindow orderFrontRegardless]; + } else { + [myWindow orderWindow: NSWindowAbove relativeTo: [parentWindow windowNumber]]; + } + #endif } +#endif - DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n", + DBG_PRINT( "createWindow1.%d - %p view %p, isVisible %d\n", dbgIdx++, myWindow, myView, [myWindow isVisible]); // force surface creation @@ -988,15 +956,14 @@ NS_ENDHANDLER // right mouse button down events [myView setNextResponder: myWindow]; - DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n", - dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView); + DBG_PRINT( "createWindow1.%d - %p (this), %p (parent): new window: %p, view %p\n", + dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)jparent, myWindow, myView); [myView setDestroyNotifySent: false]; setJavaWindowObject(env, jthis, myView); - DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n", - dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView); - + DBG_PRINT( "createWindow1.%d - %p view %p, fullscreen %d, setPresentationOptions has %d, options 0x%X\n", + dbgIdx++, myWindow, myView, (int)fullscreen, (int)myWindow->hasPresentationSwitch, (int)myWindow->fullscreenPresentationOptions); NS_DURING if( fullscreen ) { /** @@ -1014,20 +981,34 @@ NS_DURING } */ if( myWindow->hasPresentationSwitch ) { - DBG_PRINT( "initWindow0.%d - %p view %p, setPresentationOptions 0x%X\n", - dbgIdx++, myWindow, myView, (int)myWindow->fullscreenPresentationOptions); [NSApp setPresentationOptions: myWindow->fullscreenPresentationOptions]; } } NS_HANDLER NS_ENDHANDLER - DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n", - dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView); + DBG_PRINT( "createWindow1.%d - %p (this), %p (parent): new window: %p, view %p\n", + dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)jparent, myWindow, myView); + // [CATransaction commit]; + [pool release]; + DBG_PRINT( "createWindow1.X - %p (this), %p (parent): new window: %p, view %p\n", + (void*)(intptr_t)jthis, (void*)(intptr_t)jparent, myWindow, myView); + + return (jlong) (intptr_t) myWindow; +} + +JNIEXPORT jint JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getDisplayID0(JNIEnv *env, jobject jthis, jlong window) { + NewtNSWindow* myWindow = (NewtNSWindow*) ((intptr_t) window); + if( NULL == myWindow ) { + DBG_PRINT( "getDisplayID0 - NULL NEWT win - abort\n"); + return 0; + } + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSScreen *screen = [myWindow screen]; + int32_t displayID = (int32_t)NewtScreen_getCGDirectDisplayIDByNSScreen(screen); [pool release]; - DBG_PRINT( "initWindow0.X - %p (this), %p (parent): new window: %p, view %p\n", - (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView); + return (jint) displayID; } /** @@ -1047,9 +1028,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setPixelScale } NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NewtNSView* myView = (NewtNSView*) (intptr_t) view ; -#ifdef VERBOSE_ON - int dbgIdx = 1; -#endif + DBG_PRINT( "setPixelScale0 - %p (this), %p (window), view %p, reqPixScale %f (START)\n", (void*)(intptr_t)jthis, myWindow, myView, (float)reqPixelScale); (void)myWindow; @@ -1121,7 +1100,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_close0 NS_DURING /** * See Bug 914: We don't use exclusive fullscreen anymore (capturing display) - * See initWindow0(..) above .. + * See createWindow1(..) above .. if(NULL!=mView) { BOOL iifs; if ( [mView respondsToSelector:@selector(isInFullScreenMode)] ) { |