[client] add a SDL2 to uapi scancode table

This commit is contained in:
Tudor Brindus
2021-01-18 00:04:01 -05:00
committed by Geoffrey McRae
parent 04908c3290
commit 3935acf8a5
2 changed files with 176 additions and 49 deletions

View File

@@ -62,17 +62,6 @@ static bool sdlGetProp(LG_DSProperty prop, void * ret)
return false;
}
static inline uint32_t mapScancode(SDL_Scancode scancode)
{
uint32_t ps2;
if (scancode > (sizeof(usb_to_ps2) / sizeof(uint32_t)) || (ps2 = usb_to_ps2[scancode]) == 0)
{
DEBUG_WARN("Unable to map USB scan code: %x\n", scancode);
return 0;
}
return ps2;
}
static bool sdlEventFilter(SDL_Event * event)
{
switch(event->type)
@@ -124,14 +113,14 @@ static bool sdlEventFilter(SDL_Event * event)
case SDL_KEYDOWN:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyPress(mapScancode(sc));
app_handleKeyPress(sdl_to_xfree86[sc]);
break;
}
case SDL_KEYUP:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyRelease(mapScancode(sc));
app_handleKeyRelease(sdl_to_xfree86[sc]);
break;
}