aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/MacWindow.m
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-27 00:44:18 +0100
committerSven Gothel <[email protected]>2011-11-27 00:44:18 +0100
commit9bdc043059abc927a0cdb72b4e775d097e3c8876 (patch)
treed2852076c8211fbde96536e38d05a7a58e5b0308 /src/newt/native/MacWindow.m
parent457803bac0bf2328de160daa35542fd7c854dc4b (diff)
NEWT OSX: Add stopNSApplication(), revert commit c26d6005e1fe74e9aee01d9d72942f566884fcd2
Diffstat (limited to 'src/newt/native/MacWindow.m')
-rw-r--r--src/newt/native/MacWindow.m44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 0d63b6522..e39ff0310 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -191,13 +191,50 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_macosx_MacDisplay_initNSAppli
JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacDisplay_runNSApplication0
(JNIEnv *env, jclass clazz)
{
- // NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
DBG_PRINT( "\nrunNSApplication0.0\n");
[NSApp run];
DBG_PRINT( "\nrunNSApplication0.X\n");
- // [pool release];
+ [pool release];
+}
+
+/*
+ * Class: jogamp_newt_driver_macosx_MacDisplay
+ * Method: stopNSApplication0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacDisplay_stopNSApplication0
+ (JNIEnv *env, jclass clazz)
+{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT( "\nstopNSApplication0.0 nsApp.running %d\n", (NSApp && [NSApp isRunning]));
+
+ if(NSApp && [NSApp isRunning]) {
+ [NSApp performSelectorOnMainThread:@selector(stop:) withObject:nil waitUntilDone:YES];
+ // [NSApp stop: nil];
+ NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
+ location: NSMakePoint(0,0)
+ modifierFlags: 0
+ timestamp: 0.0
+ windowNumber: 0
+ context: nil
+ subtype: 0
+ data1: 0
+ data2: 0];
+ DBG_PRINT( "\nstopNSApplication0.1\n");
+ [NSApp postEvent: event atStart: true];
+ }
+ /**
+ DBG_PRINT( "\nstopNSApplication0.2\n");
+ if(NSApp && [NSApp isRunning]) {
+ DBG_PRINT( "\nstopNSApplication0.3\n");
+ [NSApp terminate:nil];
+ } */
+
+ DBG_PRINT( "\nstopNSApplication0.X\n");
+ [pool release];
}
/*
@@ -443,6 +480,8 @@ NS_DURING
if([mView isInFullScreenMode]) {
[mView exitFullScreenModeWithOptions: NULL];
}
+ [mWin setContentView: nil];
+ [mView release];
}
NS_HANDLER
NS_ENDHANDLER
@@ -450,6 +489,7 @@ NS_ENDHANDLER
if(NULL!=pWin) {
[mWin detachFromParent: pWin];
}
+ [mWin orderOut: mWin];
DBG_PRINT( "windowClose.1 - %p,%d view %p,%d, parent %p\n",
mWin, getRetainCount(mWin), mView, getRetainCount(mView), pWin);