RFR: 8360886: Cmd + plus shortcut does not work reliably [v2]
Martin Fox
mfox at openjdk.org
Mon Jul 7 16:59:13 UTC 2025
> 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.
Martin Fox has updated the pull request incrementally with one additional commit since the last revision:
Reverted manual tests, added system test, changed check for fake performKeyEquivalent event.
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1837/files
- new: https://git.openjdk.org/jfx/pull/1837/files/9ba898a9..524b3f43
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1837&range=01
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1837&range=00-01
Stats: 436 lines in 3 files changed: 295 ins; 128 del; 13 mod
Patch: https://git.openjdk.org/jfx/pull/1837.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1837/head:pull/1837
PR: https://git.openjdk.org/jfx/pull/1837
More information about the openjfx-dev
mailing list