Skip to content
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

Can not type number on Azerty-keyboard #83

Open
pietervdvn opened this issue Jun 23, 2020 · 6 comments
Open

Can not type number on Azerty-keyboard #83

pietervdvn opened this issue Jun 23, 2020 · 6 comments
Labels
widgetry Improve our internal UI library

Comments

@pietervdvn
Copy link

Hey,

Just tried AB-streets, pretty cool!

I'm on Kubuntu 19.10 with an Azerty keyboard (Belgian to be precise). These keyboards have numbers under Shift + top row. However, when attempting to type a number, this doesn't work (either I get nothing or the symbol I should get without shift is typed). A bit annoying when phasing traffic lights

The numeric keyboard didn't work either, neither with or without num-lock activated.

dabreegster added a commit that referenced this issue Jun 23, 2020
@dabreegster
Copy link
Collaborator

Apparently I got very lazy in https://github.com/dabreegster/abstreet/blob/ca22d63671cf76e5d1ae7208a9ce3e46a37358fa/ezgui/src/event.rs#L330. If you're building from source, sync and try this fix. If not, I can send a build. I'm hoping both sets are mapped to the numpad keycodes by winit; if not, let me know

@pietervdvn
Copy link
Author

I managed to build the game!

Your fix already improved this a lot - the numerical keyboard now works.
However, pressing shift + 1, this gives '!' as typed character (even though the '&' was pressed). Pressing this key without shift yields no typed character.

@dabreegster
Copy link
Collaborator

It looks like I've hardcoded this in ezgui/src/event.rs for qwerty keyboards:

Key::Num1 => Some(if shift_pressed { '!' } else { '1' }),

I'll take a look around other projects using winit and see how they handle the keycodes. winit gives virtual key codes, so afaict, it's up to the app to handle stuff like this. But surely somebody has made a library to deal with this.

@pietervdvn
Copy link
Author

Could you link the location in the source? I might do a PR

@dabreegster
Copy link
Collaborator

@pietervdvn
Copy link
Author

Hmmm, no, diving into this will be for some other time... I have to finish a few other projects first...

@dabreegster dabreegster added widgetry Improve our internal UI library and removed platform specific bug labels Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widgetry Improve our internal UI library
Projects
None yet
Development

No branches or pull requests

2 participants