Only read UNICODE values from 31 to 254 to make sure we do not read any non-printable characters and prefer the keysym that way; Added left and right Command Key for MAC Keyboards

This commit is contained in:
zicodxx 2008-11-07 11:09:29 +00:00
parent 87f6ecce75
commit 804ac4c683
2 changed files with 8 additions and 4 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog D1X-Rebirth Changelog
20081107
--------
arch/sdl/key.c: Only read UNICODE values from 31 to 254 to make sure we do not read any non-printable characters and prefer the keysym that way; Added left and right Command Key for MAC Keyboards
20081103 20081103
-------- --------
misc/args.c: Fixed Typo misc/args.c: Fixed Typo

View file

@ -217,8 +217,8 @@ key_props key_properties[256] = {
{ "", 255, -1 }, { "", 255, -1 },
{ "PAD", 255, SDLK_KP_ENTER }, { "PAD", 255, SDLK_KP_ENTER },
{ "RCTRL", 255, SDLK_RCTRL }, { "RCTRL", 255, SDLK_RCTRL },
{ "", 255, -1 }, { "LCMD", 255, SDLK_LMETA },
{ "", 255, -1 }, { "RCMD", 255, SDLK_RMETA },
{ "", 255, -1 }, // 160 { "", 255, -1 }, // 160
{ "", 255, -1 }, { "", 255, -1 },
{ "", 255, -1 }, { "", 255, -1 },
@ -359,7 +359,7 @@ void key_handler(SDL_KeyboardEvent *event)
event_keysym = event->keysym.sym; event_keysym = event->keysym.sym;
// Read (latin) unicode // Read (latin) unicode
if (event->keysym.unicode > 31) if (event->keysym.unicode > 31 && event->keysym.unicode < 255)
{ {
event_keyuni = tolower(event->keysym.unicode); event_keyuni = tolower(event->keysym.unicode);
// Now add the UNICODE char to our map (see comment on sym2unimap declaration) // Now add the UNICODE char to our map (see comment on sym2unimap declaration)
@ -373,7 +373,7 @@ void key_handler(SDL_KeyboardEvent *event)
} }
} }
} }
else // UNICODE reported as 0 - now check which one! else // no valid UNICODE - possibly 0 - see if we remove it from the list
{ {
for (i = 0; i < KEY_BUFFER_SIZE; i++) for (i = 0; i < KEY_BUFFER_SIZE; i++)
{ {