keyboard: Use SDL_SetKeymap() to set the default keymap

This ensures the AZERTY workaround is applied for backends that
never call SDL_SetKeymap() themselves.
This commit is contained in:
Cameron Gutman
2022-07-31 16:10:10 -05:00
committed by Sam Lantinga
parent 8b438f7b51
commit 9515fb2501
2 changed files with 4 additions and 6 deletions

View File

@@ -560,11 +560,9 @@ SDL_UCS4ToUTF8(Uint32 ch, char *dst)
int
SDL_KeyboardInit(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
/* Set the default keymap */
SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
return (0);
SDL_SetKeymap(0, SDL_default_keymap, SDL_NUM_SCANCODES, SDL_FALSE);
return 0;
}
void
@@ -590,7 +588,7 @@ SDL_GetDefaultKeymap(SDL_Keycode * keymap)
}
void
SDL_SetKeymap(int start, SDL_Keycode * keys, int length, SDL_bool send_event)
SDL_SetKeymap(int start, const SDL_Keycode * keys, int length, SDL_bool send_event)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;