Skip to content

Commit

Permalink
[SDL backend] keyScanToString: Display the *virtual* key name
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Nov 11, 2023
1 parent 567b17d commit 38f5cef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/sdl/main_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ static void inputAddBuffer(UDWORD key, utf_32_char unicode)
pEndBuffer = pNext;
}

// Returns the human-readable name for the key *in the current keyboard layout*
void keyScanToString(KEY_CODE code, char *ascii, UDWORD maxStringSize)
{
if (code == KEY_LCTRL)
Expand Down Expand Up @@ -1146,7 +1147,7 @@ void keyScanToString(KEY_CODE code, char *ascii, UDWORD maxStringSize)

if (code < KEY_MAXSCAN)
{
snprintf(ascii, maxStringSize, "%s", SDL_GetScancodeName(keyCodeToSDLScancode(code)));
snprintf(ascii, maxStringSize, "%s", SDL_GetKeyName(SDL_GetKeyFromScancode(keyCodeToSDLScancode(code))));
if (ascii[0] >= 'a' && ascii[0] <= 'z' && ascii[1] != 0)
{
// capitalize
Expand Down

0 comments on commit 38f5cef

Please sign in to comment.