The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Meaning of SDLK_* - undocumented and inconsistent behavior
Ryan C. Gordon
Guest

Quote:
What is the supposed meaning of the SDL_Event.key.keysym.sym field and
the corresponding SDLK_* constants? Is SDLK_z

1. "the key that would be labeled 'Z' on a US keyboard", i.e. a
reference to a key at a specific hardware position, or

2. "the key that's labeled 'Z'", i.e. a reference to a key that
generates a specific character?

I believe it was meant to be "the key that's labeled 'Z' on Sam's
keyboard". :)

Realistically, people actually wanting to know text input should be
using the Unicode field, but there's probably a lot of code out there
that is counting on these to match up.

Does anyone have any opinions on this?

--ryan.
Meaning of SDLK_* - undocumented and inconsistent behavior
Sam Lantinga
Guest

Quote:
Quote:
What is the supposed meaning of the SDL_Event.key.keysym.sym field and
the corresponding SDLK_* constants? Is SDLK_z

1. "the key that would be labeled 'Z' on a US keyboard", i.e. a
reference to a key at a specific hardware position, or

2. "the key that's labeled 'Z'", i.e. a reference to a key that
generates a specific character?

Quote:
I believe it was meant to be "the key that's labeled 'Z' on Sam's
keyboard". Smile

Quote:
Realistically, people actually wanting to know text input should be
using the Unicode field, but there's probably a lot of code out there
that is counting on these to match up.

Quote:
Does anyone have any opinions on this?

After working with World of Warcraft's code, I figured out how to do it
the way I had always intended, which is to map to the unshifted code for
the current keyboard. Unfortunately, this leaves SDL's keysym set lacking,
and this can't be addressed until a major API change (1.3)

To answer your question, it should generally be option 2, specifically
so those programs which make that assumption (almost all emulators) will
work correctly.

See ya,
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment