RFR: 8089373: Translation from character to key code is not sufficient
John Hendrikx
jhendrikx at openjdk.org
Wed May 10 07:07:19 UTC 2023
On Tue, 9 May 2023 20:38:35 GMT, Martin Fox <duke at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/native-glass/win/KeyTable.cpp line 366:
>>
>>> 364: UINT keyChar = ::MapVirtualKeyEx(UINT(hardwareCode), 2, layout);
>>> 365: // Filter out dead keys
>>> 366: BOOL isDead = (keyChar & 0x80000000) != 0;
>>
>> Wouldn't `hardwareCode >= 0` already filter out dead keys since when the highest bit is set the value is negative?
>
> I just realized that I never actually said what `hardwareCode` means on this platform.
>
> A negative number means the `hardwareCode` isn't known (in other words, the KeyEvent wasn't constructed by glass). If it's not negative it's a Windows VK code that identifies the key the user pressed. That code doesn't reflect whether the key is dead or not. Here I'm asking what character that key would generate if pressed without any modifiers and ignoring it if the key is dead.
I misread partially, somehow I read `keyChar` as the same as `hardwareCode`. LGTM then.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1126#discussion_r1189443592
More information about the openjfx-dev
mailing list