I’m trying to understand scancodes and how they differ from keycodes, and I thought I did but the example at https://wiki.libsdl.org/SDL_Scancode#code_examples made me unsure.
if (event->key.keysym.scancode != SDL_GetScancodeFromKey(event->key.keysym.sym)) {
If SDL_GetScancodeFromKey always just looked up the keycode in the table that is shown above the example and returned the scancode on the same row (e.g. SDLK_a → SDL_SCANCODE_A, SDLK_b → SDL_SCANCODE_B, etc.) then I can understand but according to the SDL_GetScancodeFromKey page it’s based on the current keyboard layout so it seems to me like this condition would always be false because SDL has already done this mapping when creating the key event.
Is the example wrong, or is the SDL_GetScancodeFromKey page wrong, or am I wrong? I only have a QWERTY keyboard so I haven’t been able to test when the mapping is different.