RFR: 8274967: KeyCharacterCombinations for punctuation and symbols fail on non-US keyboards

Martin Fox duke at openjdk.java.net
Mon Nov 15 20:19:54 UTC 2021


The code that maps from a Windows virtual key code to a Java key code in `getKeyCodeForChar` did not match the similar code in `ViewContainer::HandleViewKeyEvent`. The OEM keys are assigned to printable punctuation and symbols in way which varies across layouts and even keyboards. To determine the correct Java key code you have to query the layout to determine the character the key would generate without modifiers and map that character to the key code. `ViewContainer::HandleViewKeyEvent` did this, `getKeyCodeForChar` did not. This PR copies a few snippets of code from `ViewContainer::HandleViewKeyEvent` to make the two algorithms match.

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

Commit messages:
 - getKeyCodeForChar works on non-US layouts for symbols and punctuation

Changes: https://git.openjdk.java.net/jfx/pull/672/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=672&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8274967
  Stats: 70 lines in 1 file changed: 67 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jfx/pull/672.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/672/head:pull/672

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


More information about the openjfx-dev mailing list