Add the raw platform specific key code to SDL_Keysym

This allows applications to handle keys that SDL doesn't recognize, in a platform dependent way.

Fixes https://github.com/libsdl-org/SDL/issues/6390
This commit is contained in:
Sam Lantinga
2024-06-18 18:34:55 -07:00
parent 9d816c72ef
commit ef9bd8b609
24 changed files with 163 additions and 139 deletions

View File

@@ -121,16 +121,18 @@ PrintKey(SDL_Keysym *sym, SDL_bool pressed, SDL_bool repeat)
/* Print the keycode, name and state */
if (sym->sym) {
print_string(&spot, &left,
"Key %s: scancode %d = %s, keycode 0x%08X = %s ",
"Key %s: raw 0x%.2x, scancode %d = %s, keycode 0x%08X = %s ",
pressed ? "pressed " : "released",
sym->raw,
sym->scancode,
SDL_GetScancodeName(sym->scancode),
sym->scancode == SDL_SCANCODE_UNKNOWN ? "UNKNOWN" : SDL_GetScancodeName(sym->scancode),
sym->sym, SDL_GetKeyName(sym->sym));
} else {
print_string(&spot, &left,
"Unknown Key (scancode %d = %s) %s ",
"Unknown Key (raw 0x%.2x, scancode %d = %s) %s ",
sym->raw,
sym->scancode,
SDL_GetScancodeName(sym->scancode),
sym->scancode == SDL_SCANCODE_UNKNOWN ? "UNKNOWN" : SDL_GetScancodeName(sym->scancode),
pressed ? "pressed " : "released");
}
print_modifiers(&spot, &left);