I'm not getting the -(void)keyDown callback on my inherited NSOpenGLView (note that mouseMoved does not work either though I do setAcceptsMouseMovedEvents:YES, but that is not an issue yet). It implements
- (BOOL)acceptsFirstResponder
{
return YES;
}
but still no luck. My knowledgeable friend implied that it might have something to do with that the application is still a console application and not a bundled .app (I'm currently porting it). If so: is there some way to circumvent? Could the cause be something else? When I terminate my console application, I frequently see all my keypresses go to stdout so it does seem reasonable...
Edit:
@implementation UiMacApplication
- (void)run
{
}
- (void)terminate:(id)sender
{
...
}
- (void)startDummyThread:(id)sender
{
printf("startDummyThread!\n");
}
@end
....
mApplication = (UiMacApplication*)[UiMacApplication sharedApplication];
[NSThread detachNewThreadSelector: @selector(startDummyThread:) toTarget: mApplication withObject: nil];
[[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillFinishLaunchingNotification object: NSApp];
[[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationDidFinishLaunchingNotification object: NSApp];
Main loop:
NSEvent* event = [mApplication nextEventMatchingMask: NSAnyEventMask
untilDate: nil
inMode: NSDefaultRunLoopMode
dequeue: YES];
[mApplication sendEvent: event];
[mApplication updateWindows];