RFR: 8282217: Key events (key char and key code) changed for Swiss keyboard [v2]

Nikita Provotorov duke at openjdk.org
Wed Jan 25 03:47:08 UTC 2023


On Tue, 24 Jan 2023 20:14:20 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Removed check for MapVirtualKeyEx return value causing some keys to become undefined
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   readded check for dead key leading bit, added separate check for group separator

Changes requested by NikitkoCent at github.com (no known OpenJDK username).

src/java.desktop/windows/native/libawt/windows/awt_Component.cpp line 3620:

> 3618:     int converted = 1;
> 3619:     UINT ch = ::MapVirtualKeyEx(wkey, 2, GetKeyboardLayout());
> 3620:     if (ch & 0x80000000 && ch != 0x800000A8) {

1. It doesn't work for third key press in case of key's pressing 3 times in a row
2. Adding the workaround here is a quite dangerous because it affects the state of the `deadKeyActive` flag. I think it could break some exotic cases, e.g. when the char is used as a [chained dead key](https://en.wikipedia.org/wiki/Dead_key#Chained_dead_keys).

Actually I don't believe that adjusting logic of reporting keyChars for KEY_PRESSED events is the right way. The specification clearly says
> the result of the getKeyChar method is guaranteed to be meaningful only for KEY_TYPED events

So clients can't depend on that IMHO.

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

PR: https://git.openjdk.org/jdk/pull/11887



More information about the client-libs-dev mailing list