-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix broken keyboard input API #517
Comments
I think there are two separated issues here. About the key repeat issue: you shouldn't be handling key repeat on your own outside Miniquad. This is just a Wayland backend issue: right now for Wayland, the key down events are sent every frame as soon as you press the key, and you shouldn't be relying on this behavior that is completely different from other platforms (but now corrected in #535, so you won't need to handle it anymore). On the other hand, I do agree that we should replace the current Ideally we should have |
Proposed API:
KeyEvent then has this API: https://doc.qt.io/qt-6/qkeyevent.html
KeyPhase has Press, Release, Canceled
Check this log:
This is the same key being held, but the API does not give any indication of that.
The proposed API would fix this, since KeyEvent gives access to the native virtual keycodes for that platform. They should not be relied upon to be consistent across platforms but to simply map to unique keys on that device. This would allow us to clearly see key down and release events despite the char/key changing.
Also you can call .chr() to get the actual char, or try to get the KeyCode. This would make existing code simpler too, since right now I have code like:
With this change, I can simply handle all key events in one place directly rather than having to deal with crossover from both key_down(KeyCode::A) and char_event('A').
The text was updated successfully, but these errors were encountered: