Input Method Kit does not handle NSKeyUp events. Chorded keyboards are thus impossible to implement.

I was very excited to find Input Method Kit. I was planning on creating software implementations of various specialized hardware keyboards.


https://developer.apple.com/library/mac/documentation/Cocoa/Reference/InputMethodKitFrameworkRef/


Unfortunately I have found that Input Method Kit does not catch NSEvents of type NSKeyUp.


rdar://21376535


This immediately disqualifies all "chorded" input methods. One cannot calculate chording without knowing when keys are pressed down and (importantly) when they go back up.


https://en.wikipedia.org/wiki/Chorded_keyboard


Because Input Method Kit does not catch NSKeyUp events, I cannot calculate if keys are being pressed at the same time. Chording keyboard input methods will thus not work.


Other OS X technologies such as CGEventTap or [NSEvent addLocalMonitorForEventsMatchingMask:] allow for monitoring key events of NSKeyUp, in addition to NSKeyDown or other types. Input Method Kit only allows monitoring of NSKeyDown.


Additionally, returning `NSKeyUpMask` from IMKStateSetting `recognizedEvents:` does NOT enable the NSKeyUp events in IMKit. It seems like it should.


- (NSUInteger)recognizedEvents:(id)sender {

return NSKeyUpMask;

}


Using `recognizedEvents:` works for some other event types, such as FlagsChanged. But it doesn't work for KeyUp.


Steps to Reproduce:

1. Implement an Input Method Kit app (similar to the NumberInput Apple sample code)

2. Implement the IMKit method `handleEvent:client:`

3. Activate your Input Method

4. As you press keys, notice that the `NSKeyDown` events are seen and handled by your input method.

5. As the keys spring back up, notice that `NSKeyUp` events are NOT seen or handled by your input method.


Expected Results:

The input method should see both NSKeyDown and NSKeyUp events.


IMKStateSetting `recognizedEvents:` allows setting of NSKeyUpMask.


NSKeyUp events are *vital* for many input methods, such as chorded keyboards.


Actual Results:

NSKeyUp events are not observed by your input method. Only NSKeyDown events are seen.


Unable to handle NSKeyUp events.


Unable to implement a software chorded keyboard input method


rdar://21376535