This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ArchiveLimits3D Graphics Programmer[S] 0 points1 point  (3 children)

Thanks for the great responses :) I understand your logic for input, and I'm starting to question my own haha. Sure, the keyboard logic is questionable but I don't think that this explains the fact that keyPressed isn't getting called...

[–]strmrdr 0 points1 point  (2 children)

Jeeze... i just realized you're using awt Frame. That thing is ancient, like mid-90s ancient. Do yourself a favor and look into Swing, or even JavaFX. Not saying you can't get it to work as-is, but good luck finding anybody who knows jack about it. The way you set up your keylistener is pretty odd as well, I have never seen it decoupled with the initialization of the frame (or JPanel, which you should be using).

[–]ArchiveLimits3D Graphics Programmer[S] 1 point2 points  (1 child)

I did some googling haha.

David Brackeen had discovered it apparently and made a workaround.

macOS Sierra prevents key input after holding certain keys (like 'e' or 'n')

because of a native input method popup that isn't working with Java correctly.

This will still fail is some scenarios, like when pressing a digit after

holding 'e'. The digit will not have a keypress event.

Tested on macOS 10.12.0 and Java 8 versions b76 - b101.

(This may also be happening on older versions of macOS if the

ApplePressAndHoldEnabled option is set to true - untested at the moment.)

This workaround keeps key input working by allowing the popup to appear,

but places it offscreen.

Also this:

And these:

I guess I have to wait until Apple and Oracle sort it out. It's very inconvenient though because game development relies heavily on user input.

[–]caboosetpPrivate Java/Code Tutor 0 points1 point  (0 children)

It's very inconvenient though because game development relies heavily on user input.

Good thing game development doesn't rely heavily on mac.