When entering characters using IME on Windows, Japanese and Chinese will both result in the first keystroke being duplicated. You end up with an extra unwanted character. Following shows entering "Hello" and getting an extra "n" in front:
The central problem to fix is that we get WM_IME_STARTCOMPOSITION event too late, after the first character is entered. In processKeyEvent we could just ignore all keys when IME is on. That would fix this problem with duplicated initial key, but would not allow editing like backspace, arrows, deleting, etc. And we also have to deal with the issue of entering English characters too.
This patches add support for getting the conversion status flags and modes using ImmGetConversionStatus. With these we can determine if we are composing, if in English mode, and other details. Then we can ignore or pass along different keypresses, depending on the language.
Tested in Chinese, Japanese. and Korean with a variety of input editors and methods.



