diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-15 05:15:44 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-15 05:15:44 -0400 |
| commit | 441b8c7c735d1974e6dbf757f6a2965f2f645d68 (patch) | |
| tree | 61307f5c28bb46ac50f57acd6b19beac62f6f32e | |
| parent | e556f92e52941ec147b8aa5a22f4341cfdaa93ab (diff) | |
Implemented applicationShouldTerminate: and applicationShouldTerminateAfterLastWindowClosed: on Mac OS X.
| -rw-r--r-- | redo/future | 2 | ||||
| -rw-r--r-- | redo/uitask_darwin.m | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/redo/future b/redo/future index e3189a9..6b1680c 100644 --- a/redo/future +++ b/redo/future @@ -61,8 +61,6 @@ windows - tab order is backwards - flicker ahoy - not all controls are transparent -mac os x - - applicationShouldTerminate: not handled gtk+ - Area: default buttons, escape all diff --git a/redo/uitask_darwin.m b/redo/uitask_darwin.m index 29c9475..e45e09c 100644 --- a/redo/uitask_darwin.m +++ b/redo/uitask_darwin.m @@ -47,6 +47,33 @@ static Class areaClass; @end @implementation appDelegateClass + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app +{ + NSArray *windows; + NSUInteger i, n; + + windows = [NSApp windows]; + n = [windows count]; + for (i = 0; i < n; i++) { + NSWindow *w; + + w = toNSWindow([windows objectAtIndex:i]); + if (![[w delegate] windowShouldClose:w]) + // stop at the first rejection; thanks Lyle42 in irc.freenode.net/#macdev + return NSTerminateCancel; + } + // all windows closed; stop gracefully for Go + uistop(); + // TODO can't use NSTerminateLater here as the run loop is different (???) + return NSTerminateCancel; +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app +{ + return NO; +} + @end appDelegateClass *appDelegate; |
