I have my own event-loop where I call nextEventMatchingMask: repeatedly.
Many examples I found just pass a untilDate of [NSDate distantPast] to get
this behaviour as stated in the documentation but this doesn't seem to work
for me - even in a very simple setting.
Can anyone see what's wrong?
int main(int argc, char **args){
NSRect frame = NSMakeRect(100, 100, 500, 400);
NSApplication *application = [NSApplication sharedApplication];
NSWindow* window = [[NSWindow alloc] initWithContentRect:frame
styleMask:NSBorderlessWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask
backing:NSBackingStoreBuffered
defer:NO];
// Start the main event loop:
[application finishLaunching];
while(true) {
NSEvent *event;
while ( event =
[application
nextEventMatchingMask:NSAnyEventMask
untilDate: [NSDate distantPast] // nil
inMode:NSDefaultRunLoopMode
dequeue:YES] )
{
NSLog(@"Event: %@", (id)event);
[application sendEvent:event];
[application updateWindows];
}
}
return 0;
}
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]