On Fri, 12 Mar 2021 21:28:38 GMT, Tom Schindl <tschi...@openjdk.org> wrote:

>> @kevinrushforth I have a manual app that can perform a simple test to verify 
>> that when a robot sends KeyCode.A through KeyCode.Z the system receives the 
>> characters 'a' to 'z'. On the Mac this sanity test was failing on German and 
>> French keyboards prior to these changes. The test is part of a key logger 
>> app I created.
>> 
>> I chose this bug because it has a straight-forward test attached and some 
>> recent comment activity.
>> 
>> @tomsontom Could you point me to the relevant code in Swing? I'm looking at 
>> the code but am getting lost in the layers.
>
> https://github.com/openjdk/jdk/blob/8760688d213865eaf1bd675056eb809cdae67048/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m#L462

On the French keyboard the digits are shifted but I assumed we would still want 
those keys to map to KeyCode.0-9 as they do on Windows. My solution was to 
hard-code those key positions to be digits but this interferes with Dvorak 
layouts. I'm tweaking the implementation to fix this. The new approach will be 
to query both the shifted and unshifted characters on a key and favor digits 
and letters over everything else (and something over nothing).

(I've been writing Mac code to enumerate all the OS keyboard layouts and 
generate lists showing which Java key codes will change from the historic 
implementation. It also does some sanity checking.)

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

PR: https://git.openjdk.java.net/jfx/pull/425

Reply via email to