Fixed issue 167: Crashes on win98 with international keyboards (SDL.DLL, recompiled from 1.2.13 source archive)

Fixed old bug (all platforms): When typing text with dead-keys like ^ ` it would additionally type the character on same key for US-QWERTY keyboard.
Removed the "disable Unicode" option added in r814, no longer needed.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@816 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2009-05-23 01:29:18 +00:00
parent 9e4866e34c
commit 4191b37099
7 changed files with 14 additions and 76 deletions

View File

@@ -543,59 +543,19 @@ word Keysym_to_ANSI(SDL_keysym keysym)
#if !(defined(__macosx__) || defined(__FreeBSD__))
if ( keysym.unicode == 0)
{
byte shift;
shift = (SDL_GetModState() & (KMOD_SHIFT|KMOD_CAPS)) != 0;
// Convert keypad to numbers
if (keysym.sym >= SDLK_KP0 && keysym.sym <= SDLK_KP9)
return ('0' - SDLK_KP0) + keysym.sym;
// Conversion with shift on
if (shift)
switch(keysym.sym)
{
// Lowercase to uppercase.
if (keysym.sym >= 'a' && keysym.sym <= 'z' && shift)
return ('A' - 'a') + keysym.sym;
// Some shifts of QWERTY-US keys
switch (keysym.sym)
{
case '`': return '~';
case '1': return '!';
case '2': return '@';
case '3': return '#';
case '4': return '$';
case '5': return '%';
case '6': return '^';
case '7': return '&';
case '8': return '*';
case '9': return '(';
case '0': return ')';
case '-': return '_';
case '=': return '+';
case '\\': return '|';
case '[': return '{';
case ']': return '}';
case ';': return ':';
case '\'': return '"';
case ',': return '<';
case '.': return '>';
case '/': return '?';
default:
return keysym.sym;
}
}
// More conversions
switch (keysym.sym)
{
case SDLK_KP_PERIOD: return '.';
case SDLK_KP_DIVIDE: return '/';
case SDLK_KP_MINUS: return '-';
case SDLK_KP_MULTIPLY: return '*';
case SDLK_KP_PLUS: return '+';
case SDLK_KP_ENTER: return '\r';
case SDLK_KP_EQUALS: return '=';
default:
case SDLK_DELETE:
case SDLK_LEFT:
case SDLK_RIGHT:
case SDLK_HOME:
case SDLK_END:
case SDLK_BACKSPACE:
case KEY_ESC:
case SDLK_RETURN:
return keysym.sym;
default:
return 0;
}
}
#endif