On Tue, 21 Sep 2021 22:39:12 GMT, Phil Race <[email protected]> wrote:

> where did this value come from ?

The 0x01000000 offset value is copied from 
share/classes/sun/awt/ExtendedKeyCodes.java. When using 
getExtendedKeyCodeForChar(int c), if the character isn't in the 
regularKeyCodesMap, that 0x01000000 offset is added and the new value is 
checked for again in the extendedKeyCodeSet. I noticed that Russian was in the 
extendedKeyCodeSet so I just checked for Russian active keyboard layout and 
added that offset since the case wasn't being handled before. 

> Are we doing something weird, or does macOS really make developers have to 
> understand every single supported language -> keyboard mapping ?
Is there a better (more generic) way ?

I can try to test whether removing the Russian language check also fixes other 
languages (since that's what we do in ExtendedKeyCodes.java anyway), but macOS 
might have a different system of keycodes so I can't tell for sure that it 
would work for all of them.

> Is this the ONLY place we'd need to add understanding of Russian ? If there's 
> more it would not be worth doing it just here.

>From my understanding anything that relies on keycodes would be fixed with 
>this since AWTEvent.m was only checking for English to translate NSKeyCodes to 
>Java virtual keycodes. I didn't see anywhere else related to keycodes we would 
>need to have a language check .

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

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

Reply via email to