[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    RFR: 8273743: KeyCharacterCombination for "+" does not work on US QWERTY keyboard layout
From:       Martin Fox <github.com+12087024+beldenfox () openjdk ! java ! net>
Date:       2021-09-28 21:07:01
Message-ID: 34JAQYedjNtwzb-HyVlczGg-WQp2fzL1DwzB-FHSkHw=.7850793e-4a7f-46c6-951d-bb557f52ca24 () github ! com
[Download RAW message or body]

There was a mismatch between the way `get_glass_key` generated the Java key code for \
a given key press and how `getKeyCodeForChar` determined the key code for the \
matching character. For example, when pressing the plus sign on a US keyboard \
`get_glass_key` correctly generated `KeyCode.EQUALS` but `getKeyCodeForChar("+")` \
generated `KeyCode.PLUS`.

In this PR `getKeyCodeForChar` mirrors the behavior of `get_glass_key`; it determines \
which key the character lies on and generates a key code based on the unshifted \
character on  the same key.

I'm working on a more comprehensive test case that allows you to press any key on the \
keyboard and test whether a KeyCharacterCombination for that character will succeed \
or not. I've attached it to this thread. It might be worth submitting as a manual \
test case [CharComboTest.txt](https://github.com/openjdk/jfx/files/7247265/CharComboTest.txt)
                
.

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

Commit messages:
 - Query the current keyboard layout and key to correctly respond to \
getKeyCodeForChar.

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic