<AWT Dev> [14] RFR JDK-8214578: [macos] Problem with backslashes on macOS/JIS keyboard: Java ignores system settings

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Wed Oct 9 09:54:20 UTC 2019


Hi Sergey,

On 02-Oct-19 1:35 AM, Sergey Bylokhov wrote:
> Hi, Prasanta.
>
> I did not find any documentation for TISGetInputSourceProperty, does 
> it public API?
> But I found a list of related crashes in some applications because the 
> TISGetInputSourceProperty may return NULL.
>
> Can you please double check that the previous fixes which touches 
> these lines of code still works:
> JDK-8148555, JDK-8132503, JDK-8180370
>
I could not find any documentation too but it seems to be the only way 
to get the current keyboard layout in mac, as I could get from search. 
As the fix has been tested in multiple systems, I do not see any problem.

I have added a null check to initialize keyboard layout to US if 
TISGetInputSourceProperty is null, so that the default US keyboard will 
work.

http://cr.openjdk.java.net/~psadhukhan/8214578/webrev.2/

I have also checked the above fixes which still works.

Regards
Prasanta
> On 9/25/19 4:18 am, Prasanta Sadhukhan wrote:
>> Hi All,
>>
>> Please review a fix for an issue where it is seen that Java apps 
>> ignore system settings regarding handling yen key.
>>
>> If we use mac keyboard layout to use Japanese input source and 
>> "Change Settings -> Keyboard -> Input Sources -> Japanese -> "Â¥" key 
>> generates -> \ (Backslash) "
>> and Change Input method to Romaji and press "yen" symbol in Japanese 
>> keyboard or "option+y" key combination in US keyboard
>> Java app still interprets it as "yen" in JTextField
>>
>> Issue seems to happen due to fact when NSTextInputClient.insertText() 
>> method is called, even though "\" codePoint is passed,
>>
>> but insertText() has a check for codePoint is complex or not, so in 
>> this case, it is not complex, InputMethodEvent is not generated and 
>> no "\" is inserted in JTextField.
>>
>> Proposed fix is to see if keyboard layout is Japanese (kotoeri) and 
>> codePoint is "\" then take it as complex codepoint and generate IME,
>>
>> so that whatever system setting is set for "yen" symbol, it is 
>> correctly interpreted and inputted in CInputMethod.insertText() 
>> method, to be seen in JTextField.
>>
>> The fix has been tested in US keyboard and Japanese keyboard.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8214578
>>
>> webrev: http://cr.openjdk.java.net/~psadhukhan/8214578/webrev.0/
>>
>> Regards
>> Prasanta
>>
>
>


More information about the awt-dev mailing list