Hi,

I have a workaround for bug JDK-8167263: "[macos] Java keyPressed function of Key Listener doesn't work for W, A, S, D"

However, I do not have rights to post on the discussion for this bug so perhaps someone could post this message to the thread?
The thread is at: https://bugs.openjdk.java.net/browse/JDK-8167263

Workaround:

The problem of missing events is related the macOS feature which offers the character accent menu when a key is held down, instead of auto-repeating.

I experienced the same problem described in the bug but with a different set of keys. (In my case Z, X, : and .) When I disabled the character accent menu the problem disappeared and key events auto-repeated as expected.

To disabled the character accent menu and enable auto-repeat, type the following at the command prompt:

    defaults write -g ApplePressAndHoldEnabled -bool false

This can be reversed with the following:

    defaults write -g ApplePressAndHoldEnabled -bool true

Hopefully this will provide a pointer for your team to work out how to do this programmatically, but until then the workaround can help interested users.

Yours,

Gareth

Reply via email to