On Fri, 28 Jan 2022 09:38:35 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> If we press " ´ " (on U.S. keyboard layout it is the [+] button just before 
> the [delete] button), and then press "s" , 2 "´" characters are entered in a 
> text field instead of "´s" with "Finish" keyboard layout.
> This is because, although " ´ " is construed as "complex" char and inserted 
> properly the next "s" character is treated as non-complex character as it's 
> utf8Length is 1 and utf16Length is 2, so we need to explicitly make it a 
> "complex" char sequence if the code point is 0x73 ie "s" in Finnish layout 
> for it to be inserted properly.

Actually, this method "insertText" gets called when the user commits text 
generated from an input method, which in this case, is from Finnish keyboard 
layout 
[]https://github.com/openjdk/jdk/blame/master/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m#L946
 I don't think there is any docs for it and most of it came along with the 
macos port. The "complex" char is basically the "aStringIsComplex" condition I 
am talking about.

As per the conditions written in this method 
[]https://github.com/openjdk/jdk/blame/master/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m#L975-L991
 [] the Input method event is generated or CInputMethod#insertText for that 
**particular language** is called only when these conditions are satisfied. If 
these conditions are not met, then keyevent gets handled by 
CPlatformResponder#handleKeyEvent without taking "current "language " into 
account

"s" is therefore routed through CInputMethod#insertText by satisfying the 
condition so that it gets inserted as per Finnish "language" selected.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7262

Reply via email to