EVALUATION
The behavior of Apple JDK is the following. When I type Alt+F, the special unicode symbol appears in the textfield and the menu gets activated simultaneously. When I type Alt+T, the special unicode symbol appears
in the textfield but the menu doesn't get activated. (Other Alt+key conminations behave the first of the
second way).
I digged the open jdk and found the following. [AWTView insertText] is called on typing Alt+key.
This is a method of NSTextInputClient protocol. Then some conditions are checked and the java
CInputMethod.insertText(String) method is called. Among those conditions there's a utf8 str length check.
If it's greater than 2, the java method is called. It creates an appropriate InputMethodEvent which is then posted, dispatched and the unicode symbol appears in the text field.
Otherwise, the key event is delivered to CPlatformResponder where it creates a KEY_TYPED event and packes
the two bytes unicode character into it. It is then treated as mnemonic and the menu is activated.
Alt+F generates a utf8 symbol of two bytes size, Alt+T generates a symbol of 3 bytes. That's the difference.
Simply ignoring the condition (utf8length > 2) in [AWTView insertText] makes all the Alt+key symbols appear
in the text field. The menu is no longer activated. For me, this behavior looks right for Mac. (The menu
gets activated by Alt+key being typed only on non-text components). I'm not sure what is the right fix though
(the change I suggested is just a try).
|