diff options
author | Sven Gothel <[email protected]> | 2011-11-09 01:11:40 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-09 01:11:40 +0100 |
commit | d8fa00d35a49f4faf5f04aeb7e2bba4e972965f5 (patch) | |
tree | 4dba00d6fcd0d6146b30553375eb018438197c27 /src/nativewindow/native | |
parent | 0d7bcd240542df38dd5ff7855f31660f5f0a7be9 (diff) |
OS X Layered View: Part3 JAWTWindow/MacOSXJAWTWindow (Java/Native)
JAWTWindow:
- Add comment about caller of cstr, since it uses reflection
- Field 'config' is of type AWTGraphicsConfiguration, validate and type it
- Impl. NativeSurfaceHolder/NativeWindowHolder 'hooks'
MacOSXJAWTWindow:
- Use agnostic JAWTUtil.isJAWTVersionUsingOffscreenLayer()
to determine 'isOffscreenLayeredSurface'.
We may promote this notion to JAWTWindow, which already holds 'isApplet'
- lockSurface() case 'isOffscreenLayeredSurface':
- Create dummy NSWindow (OSXUtil) for getWindowHandle()
- Fix chosen caps: offscreen
Diffstat (limited to 'src/nativewindow/native')
-rw-r--r-- | src/nativewindow/native/macosx/OSXmisc.m | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index 55ec83279..16a4ed148 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -171,6 +171,59 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_DestroyNSView0 /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil + * Method: CreateNSWindow0 + * Signature: (IIIIZ)J + */ +JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + (JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSRect rect = NSMakeRect(x, y, width, height); + + // Allocate the window + NSWindow* myWindow = [[NSWindow alloc] initWithContentRect: rect + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreBuffered + defer: YES]; + [myWindow setReleasedWhenClosed: YES]; // default + [myWindow setPreservesContentDuringLiveResize: YES]; + + // invisible .. + [myWindow setOpaque: NO]; + [myWindow setBackgroundColor: [NSColor clearColor]]; + + // force surface creation + // [myView lockFocus]; + // [myView unlockFocus]; + + [pool release]; + + return (jlong) ((intptr_t) myWindow); +} + +/* + * Class: Java_jogamp_nativewindow_macosx_OSXUtil + * Method: DestroyNSWindow0 + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_DestroyNSWindow0 + (JNIEnv *env, jclass unused, jlong nsWindow) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSWindow* mWin = (NSWindow*) ((intptr_t) nsWindow); + NSView* mView = [mWin contentView]; + + if(NULL!=mView) { + [mWin setContentView: nil]; + [mView release]; + } + [mWin orderOut: mWin]; + [mWin close]; // performs release! + [pool release]; +} + +/* + * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: attachJAWTSurfaceLayer * Signature: (JJ)Z */ |