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
grave accent key not working on Mac with US international layout #2921
Comments
https://pkg.go.dev/github.com/hajimehoshi/ebiten/v2#IsKeyPressed
So the French layout might be different from the US. |
I close this as this is WAI |
Hey, thanks for your answer. I don't think the layout is really the culprit here. |
What kind of keyboard are you using? |
Do you mean the hardware? It’s the integrated keyboard with the laptop. |
OK this is expected: Backquote indicates the US key by [*] I cannot wirte a single backquote character in a GitHub comment lol |
Ah sorry, I was a little misunderstanding: you said Backquote itself was not shown. |
What is your hardware keyboard's layout? (I'm using a US layout hardware keyboard) |
Yes, sorry, I realize I could have been a bit clearer 😅
Hmm, I'm testing on a 2016 Mac Book Pro Intel with Monterey 12.6.9 at the moment. Maybe I should update the system… |
You mean the labels printed on the keys? It's a French layout (azerty). The character that shows up when I type with the US layout, e.g. in a GitHub comment, is § which is different than your < 🤔 |
Ah, so apparently there are ANSI and ISO keyboards. |
Right, so it seems my machine may be misconfigured somehow, possibly? 😅 |
Possibly yes. But you have tested a GLFW app and it worked as you intended, right? Also, what would the result be in your environment? https://www.toptal.com/developers/keycode |
Ah no sorry, I have no clue how to do that 😬
With a US keyboard selected it's
with a different layout, it's different, e.g. the French layout has
The code is always Backquote though… |
OK so your browser does a hack (?) to treat your backquote key. Hmm... |
So, possibly interestingly, my M1 has a qwerty Keyboard. Is that the same layout as your M3? When I use the English US layout, and I press the key left of Z, then the keyboard ebiten example shows me «Backquote ~». The key left of 1 does not do anything. But using https://www.toptal.com/developers/keycode, For the key left of Z I get
(
So perhaps it’s me who was assuming the key left of 1 was supposed to be Backquote, when it never was? But then is there no way to capture that key press? |
No, mine is QWERTY but the left key of 1 is tilde and backquote. Also the left key of z is a shift in mine. I guess yours is |
microsoft/vscode#24153 might be related |
I'm still not sure what's going on, but exposing GLFW_KEY_WORLD1 and GLFW_KEY_WORLD2 would mitigate your issue. I'll take a look later. |
From https://issues.chromium.org/issues/40821908#comment18, the ISO layout doesn't define what top-left physical key represents. This might be § or backquote or otherwise. Even though your top-left key is printed as §, this is Apple specific. The top-left corner key should always be The left key of the left shift in your keyboard should represent backquote, so with examples/keyboard, pressing that key should show "Backquote". Is that correct? (from https://developer.apple.com/library/archive/documentation/mac/pdf/MacintoshToolboxEssentials.pdf) |
I've added KeyIntlBackslash. Please try go run github.com/hajimehoshi/ebiten/v2/examples/keyboard@7389f9ddb22e6839fb21e0de37eeb50dce8213ce |
I assume you meant right of left shift, but yes, correct, on both my laptops.
Thanks! So now, I’m wondering how I should handle things to cover all keyboards. |
Yeah, you are right. I meant the right key of the left shift. Thank you for confirming!
Unfortunately no. There is no stable way to get the state of a top-left pyhisical keyboard key in any layouts. I don't think this is a solvable issue... https://www.w3.org/TR/uievents-code/#keyboard-layout explains how chaotic keyboards are. |
With https://www.toptal.com/developers/keycode showing the IntBacklash for the key left of Z and the Backquote for the one left of 1, does it mean there is a swap somewhere happening, compared to ebiten? |
Ah it says «The physical key on the keyboard.» for |
Ebitengine tries to follow Chrome's behaviors. Firefox might be different. Also, these keys depend on Apple or Windows (see https://issues.chromium.org/issues/40821908#comment18).
Right. Browsers (and Ebitengine) try to do the best, but there is no perfect solution. As |
Oh indeed! With Chrome I see IntlBackslash on the upper left key and Backquote on the lower left one, so the opposite of Firefox. 🤔 Thanks for your prompt investigation and action! |
Ebitengine Version
3eaa03e
Operating System
Go Version (
go version
)go version go1.22.0 darwin/amd64
What steps will reproduce the problem?
then hit the key above tab and left of 1.
What is the expected result?
The key to be displayed in the top left corner, perhaps something like
Backquote, @
(I'm using a French layout, I tested Dvorak as well).What happens instead?
Nothing
Anything else you feel useful to add?
I've looked as best as I could at the code, from as far as I can tell it seems it's all wired up correctly, with Backquote mapped to the GLFW GraveAccent key code (96).
The text was updated successfully, but these errors were encountered: