Hello, I'm trying to capture keyboard input for a Window on Yosemite.
When I launch the app my mouse events are caught by the window, although any keyboard events don't trigger my NSKeyDown in sendEvent function
How I've implemented my input handling is that I've overloaded the NSApplication sendEvent, provided a switch case for all event types and then pass the event on [super sendEvent:event] if I don't have a condition for it.
Then in my main loop I check for new events here
void CocoaUpdateWindow(){
NSEvent *event;
while((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]) != nil)
[NSApp sendEvent:event];
}
I got this idea from http://stackoverflow.com/questions/6732400/cocoa-integrate-nsapplication-into-an-existing-c-mainloop
Thank you for any help :)
Also I when I do type on the window, XCode in the background is receiving the input so the events aren't even getting passed to the window in the first place.