Reputation: 18583
On Mac, the US International PC keyboard layout has dead keys for several keys such as "
, '
and backtick. When typing "
, the Mac starts input method composition - the "
shown in compose mode (usually underlined) and waits for further input. If I use a
, then the input method will complete and I'll get the character ä
. There are several such dead keys, and e.g. the British keyboard layout treats Alt+n as a dead key to give something like ñ
.
In a Java AWT application, is there any way I can disable this behaviour so that I get simply the raw keys typed? E.g. in the US International PC keyboard layout, if I type "+a, I want to receive events for "
and a
, and not one event for ä
. In the British keyboard layout, I want to type Alt+n+n and receive events for Alt+n
and n
and not ñ
.
If I call Component.enableInputMethods(false)
, then my event queue will receive the Alt+n
event, but if I then follow with n, I receive ñ
.
Similarly, if I use a Chinese keyboard layout, the popup input method is still active, even after calling Component.enableInputMethods(false)
.
Is there any way to completely disable input method processing, and receive just the keys, as typed?
For context, I'm trying to implement Vim like behaviour - normal mode editing requires ASCII input, while insert mode will of course handle input methods as expected. While it would be ideal to swap to an ASCII keyboard layout in normal mode, but even the Mac's "ABC" keyboard layout has dead keys for Alt+n
, Alt+u
, Alt+I
and Alt+e
and Alt+Backtick
. Telling users to create a custom keyboard layout with something like Ukulele is not a viable option.
Upvotes: 0
Views: 130