summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-15 12:56:33 -0400
committerPietro Gagliardi <[email protected]>2014-08-15 12:56:33 -0400
commitd132de18a6bc066d2c25ddcb9527918f70fa4c39 (patch)
tree3f07b5ac9bc11c9a0f6860d3856a5b0bff201331
parent441b8c7c735d1974e6dbf757f6a2965f2f645d68 (diff)
I HAVE DEFEATED APPKIT.
-rw-r--r--redo/uitask_darwin.m17
1 files changed, 14 insertions, 3 deletions
diff --git a/redo/uitask_darwin.m b/redo/uitask_darwin.m
index e45e09c..d802911 100644
--- a/redo/uitask_darwin.m
+++ b/redo/uitask_darwin.m
@@ -4,6 +4,8 @@
#import "_cgo_export.h"
#import <Cocoa/Cocoa.h>
+#define toNSWindow(x) ((NSWindow *) (x))
+
static Class areaClass;
@interface goApplication : NSApplication
@@ -41,6 +43,15 @@ static Class areaClass;
[super sendEvent:e];
}
+// ok AppKit, wanna play hardball? let's play hardball.
+// because I can neither break out of the special version of the NSModalPanelRunLoopMode that the regular terminate: puts us in nor avoid the exit(0); call included, I'm taking control
+// note that this is called AFTER applicationShouldTerminate:
+- (void)terminate:(id)sender
+{
+ // DO ABSOLUTELY NOTHING
+ // the magic is [NSApp run] will just... stop.
+}
+
@end
@interface appDelegateClass : NSObject <NSApplicationDelegate>
@@ -64,9 +75,8 @@ static Class areaClass;
return NSTerminateCancel;
}
// all windows closed; stop gracefully for Go
- uistop();
- // TODO can't use NSTerminateLater here as the run loop is different (???)
- return NSTerminateCancel;
+ // note that this is designed for our special terminate: above
+ return NSTerminateNow;
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app
@@ -97,6 +107,7 @@ void uiinit(char **errmsg)
void uimsgloop(void)
{
[NSApp run];
+// NSLog(@"you shouldn't see this under normal circumstances, but screw the rules, I have SUBCLASSING");
}
// don't use [NSApp terminate:]; that quits the program