RFR: 8087700: [KeyCombination, Mac] KeyCharacterCombinations behave erratically
Martin Fox
mfox at openjdk.org
Wed Nov 15 00:56:40 UTC 2023
On Tue, 14 Nov 2023 21:03:59 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> @andy-goryachev-oracle You're right, this PR also deals with the problem of the map retaining stale entries when the user switches layout. I added details about this to the JBS ticket. We could treat it as a separate bug if you want, to me it's just the sort of standard housekeeping one does when caching information.
>>
>> I also added a note about the KeyboardTest app. This PR scales back that test a bit but this is the first time we've been able to run the KeyCharacterCombinations on the Mac so that portion is basically a new test.
>>
>> Let me know if you want further information in the JBS ticket.
>
> @beldenfox thank you. I still not entirely sure what issue is being tested and how to fix it, between this PR and JBS.
> For example, when I run the application listed in JBS description with your fix, I get one "HI" - is it expected? (I also get 1 "HI" on Windows)
>
> On macOS, new KeyCodeCombination(KeyCode.MINUS, KeyCombination.CONTROL_DOWN) does not equal to new KeyCharacterCombination("-", KeyCombination.CONTROL_DOWN) (same on Windows)
>
> Interestingly, Ctrl+- on macOS with the US keyboard produces
>
>
> KeyEvent{type=KEY_PRESSED, character=<\u00>, text=, code=CONTROL, control}
> KeyEvent{type=KEY_PRESSED, character=<\u00>, text=, code=MINUS, control}
> KeyEvent{type=KEY_TYPED, character=<\u1F>, text=, code=UNDEFINED, control}
> KeyEvent{type=KEY_RELEASED, character=<\u00>, text=, code=MINUS, control}
> KeyEvent{type=KEY_RELEASED, character=<\u00>, text=, code=CONTROL}
>
>
> but on Windows, we don't get KEY_TYPED event:
>
>
> KeyEvent{type=KEY_PRESSED, character=<\u00>, text=, code=CONTROL, control, shortcut}
> KeyEvent{type=KEY_PRESSED, character=<\u00>, text=-, code=MINUS, control, shortcut}
> KeyEvent{type=KEY_RELEASED, character=<\u00>, text=-, code=MINUS, control, shortcut}
> KeyEvent{type=KEY_RELEASED, character=<\u00>, text=, code=CONTROL}
>
>
>
> is this expected?
>
> And yes, it would help if we can extract any other issues into their own tickets (unless they all being fixed by this change).
>
> If I may make one suggestion - for the sake of reviewers - to re-phrase the JBS ticket in the format of
> - steps to reproduce
> - expected outcome
> - observed outcome
>
> it would help a lot!
>
> Thanks!
@andy-goryachev-oracle What keyboard layout do you normally use on Windows? And Mac? When talking about the behavior of punctuation this is a crucial bit of information.
> but on Windows, we don't get KEY_TYPED event:
> is this expected?
When you hold down Ctrl and press a key the platform may or may not generate a low-ASCII control code. JavaFX has never tried to make the platforms consistent here, Glass just passes on whatever the OS generates. In any case the TextInputControls treat these TYPED events as nuisances, if you look in TextInputControlBehavior.java and read `defaultKeyTyped` you'll see how it tries to filter out control codes and anything else that looks like it was associated with a shortcut.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1209#issuecomment-1811629222
More information about the openjfx-dev
mailing list