On Mon, 30 Jun 2025 16:58:00 GMT, Martin Fox <m...@openjdk.org> wrote:

> The Mac platform code figures out where characters are on the keyboard as the 
> user types. The character table is updated on every key press by calling a 
> registerKeyEvent: in GlassApplication. This character table is used to 
> resolve KeyCharacterCombination accelerators like Cmd + "+".
> 
> On a US English layout when the user types Cmd + "+" on the main keyboard 
> they're actually typing Cmd + "=". There's special handling in macOS for this 
> combination that can cause two NSEvents to be sent and so there's special 
> handling in the Glass code so we don't process both events. When this special 
> case is invoked registerKeyEvent: isn't being called to update the character 
> table. This bug was introduced when code was consolidated in PR #1528.
> 
> The fix is a simple one-liner. I've added a test for this in the 
> KeyboardTest.java program. It's an isolated test because it requires the 
> Robot to send events to hold down a modifier while a character key is 
> pressed. I also updated some obsolete comments and tweaked it to test all 
> KeyCharacterCombinations since they should now work reliably on all platforms.

The reproducer fails in master and runs correctly with the fix on macOS 15.5 M1.

tests/manual/events/KeyboardTest.java line 42:

> 40: import javafx.scene.input.KeyCharacterCombination;
> 41: import javafx.scene.input.KeyCode;
> 42: import javafx.scene.input.KeyCombination;

I wonder if it is possible to add a panel to the test stage with explanations 
that are currently in the class-level javadoc?  Specifically, the fact that you 
need to configure a particular layout.

I had some work done to simplify the boilerplate in #1747, though it did not 
make it yet.

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

Marked as reviewed by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1837#pullrequestreview-2972867538
PR Review Comment: https://git.openjdk.org/jfx/pull/1837#discussion_r2176036220

Reply via email to