I have a few questions about the commits 91d157d9f283, 59fedfb8faaf
and 166712f45009.
They fixed a bug I experienced, but also may have added one. There’s also this
comment in the code that confuses me a little.
From src/video/windows/SDL_windowskeyboard.c:166.
/* Don’t allow the number keys right above the qwerty row to
translate or the top left key (grave/backquote) /
/ not mapping numbers fixes the AZERTY layout (french) causing
non-shifted number to appear by default */
if ( scancode == SDL_SCANCODE_GRAVE ) {
keymap[scancode] = SDLK_BACKQUOTE;
continue;
}
if ( scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0 ) {
keymap[scancode] = SDLK_1 + ( scancode - SDL_SCANCODE_1 );
continue;
}
Why would you not want to translate them? Are the other platform implementations
also not doing it?
Any reason the french layout is mentioned? The czech layout needs a modifier
for the numbers too.
If I understand the second part of the comment correctly, it is always preferred
to return the number keycodes for that top row and not the character that stands
for the unmodified state of the key. Perhaps it should say
‘non-shifted character’
instead?
The new problem I mentioned above probably comes from the code in the second if
statement. SDL_SCANCODE_0 gets mapped SDLK_COLON. I think the code assumes that
the SDL keycode enumeration for the numbers starts with the number 1 (like
the scancodes), but it actually starts with 0 and the code maps the keycode
to the code after 0, which is the colon.
Thanks for the help.