From e88809179b9d2d9a4f33cc933ad8ca1e4c5783be Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 10 Apr 2015 13:39:45 -0400 Subject: [PATCH] More TODO resolution and debugging stuff. --- init_darwin.m | 23 ++++++++++++++++++++++- main_darwin.m | 2 -- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/init_darwin.m b/init_darwin.m index 4a3d2db1..8d1a117f 100644 --- a/init_darwin.m +++ b/init_darwin.m @@ -14,11 +14,31 @@ { // yes that's right folks: DO ABSOLUTELY NOTHING. // the magic is [NSApp run] will just... stop. + + // for debugging + NSLog(@"in terminate:"); } @end -// TODO applicationShouldTerminateAfterLastWindowClosed +@interface uiAppDelegate : NSObject +@end + +@implementation uiAppDelegate + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app +{ + // for debugging + NSLog(@"in applicationShouldTerminate:"); + return NSTerminateNow; +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app +{ + return NO; +} + +@end uiInitOptions options; @@ -29,6 +49,7 @@ uiInitError *uiInit(uiInitOptions *o) // don't check for a NO return; something (launch services?) causes running from application bundles to always return NO when asking to change activation policy, even if the change is to the same activation policy! // see https://github.com/andlabs/ui/issues/6 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + [NSApp setDelegate:[uiAppDelegate new]]; return NULL; } diff --git a/main_darwin.m b/main_darwin.m index d19af087..981567c0 100644 --- a/main_darwin.m +++ b/main_darwin.m @@ -1,8 +1,6 @@ // 6 april 2015 #import "uipriv_darwin.h" -// TODO merge with init_darwin.m? - void uiMain(void) { [NSApp run];