summaryrefslogtreecommitdiff
path: root/delegateuitask_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-05-15 23:04:30 -0400
committerPietro Gagliardi <[email protected]>2014-05-15 23:04:30 -0400
commit08e86ea9b3e4d0b24f592ab9d2f5650de40f6bed (patch)
treef414e43800f01e054473a444e7c1848cbd7a5491 /delegateuitask_darwin.m
parent3b4924a156246928ac672c5ce3321a6f43d3b4e9 (diff)
Removed the dummy NSEvent code from bleh_darwin.m and rewrote it in Objective-C in delegateuitask_darwin.m. And now to nuke bleh_darwin.m and change all the int64_ts to intptr_ts and merge the .h files...
Diffstat (limited to 'delegateuitask_darwin.m')
-rw-r--r--delegateuitask_darwin.m15
1 files changed, 13 insertions, 2 deletions
diff --git a/delegateuitask_darwin.m b/delegateuitask_darwin.m
index 5d2ec9e..91eb83b 100644
--- a/delegateuitask_darwin.m
+++ b/delegateuitask_darwin.m
@@ -9,6 +9,7 @@
#include <AppKit/NSApplication.h>
#include <AppKit/NSWindow.h>
#include <Foundation/NSAutoreleasePool.h>
+#include <AppKit/NSEvent.h>
@interface appDelegate : NSObject
@end
@@ -80,13 +81,23 @@ void douitask(id appDelegate, void *p)
void breakMainLoop(void)
{
+ NSEvent *e;
+
// -[NSApplication stop:] stops the event loop; it won't do a clean termination, but we're not too concerned with that (at least not on the other platforms either so)
// we can't call -[NSApplication terminate:] because that will just quit the program, ensuring we never leave ui.Go()
[NSApp stop:NSApp];
// simply calling -[NSApplication stop:] is not good enough, as the stop flag is only checked when an event comes in
// we have to create a "proper" event; a blank event will just throw an exception
- [NSApp postEvent:makeDummyEvent() // TODO inline this
- atStart:NO]; // not at start, just in case there are other events pending (TODO is this correct?)
+ e = [NSEvent otherEventWithType:NSApplicationDefined
+ location:NSZeroPoint
+ modifierFlags:0
+ timestamp:0
+ windowNumber:0
+ context:nil
+ subtype:0
+ data1:0
+ data2:0];
+ [NSApp postEvent:e atStart:NO]; // not at start, just in case there are other events pending (TODO is this correct?)
}
void cocoaMainLoop(void)