Some finetuning of r736.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@738 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
svdijk 2012-09-27 12:19:19 +00:00
parent cc0e20bb02
commit 2ea63382de

View file

@ -303,8 +303,7 @@ void IN_ClearStates (void)
void IN_SendKeyEvents (void) void IN_SendKeyEvents (void)
{ {
SDL_Event event; SDL_Event event;
int sym, state; int sym, usym, state, modstate;
int modstate;
qboolean gamekey; qboolean gamekey;
gamekey = (key_dest == key_game || m_keys_bind_grab); gamekey = (key_dest == key_game || m_keys_bind_grab);
@ -350,19 +349,19 @@ void IN_SendKeyEvents (void)
switch (key_dest) switch (key_dest)
{ {
case key_game: case key_game:
if ((event.key.keysym.unicode != 0) || (modstate & KMOD_SHIFT)) if (event.key.keysym.unicode != 0)
{ /* only use unicode for ~ and ` in game mode */ { /* only use unicode for ~ and ` in game mode */
if ((event.key.keysym.unicode & 0xFF80) == 0) if ((event.key.keysym.unicode & 0xFF80) == 0)
{ {
if (((event.key.keysym.unicode & 0x7F) == '`') || usym = event.key.keysym.unicode & 0x7F;
((event.key.keysym.unicode & 0x7F) == '~') ) if (usym == '`' || usym == '~')
sym = event.key.keysym.unicode & 0x7F; sym = usym;
} }
} }
break; break;
case key_message: case key_message:
case key_console: case key_console:
if ((event.key.keysym.unicode != 0) || (modstate & KMOD_SHIFT)) if (event.key.keysym.unicode != 0)
{ {
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
if (sym == SDLK_BACKSPACE) if (sym == SDLK_BACKSPACE)
@ -374,11 +373,14 @@ void IN_SendKeyEvents (void)
#endif /* __QNX__ */ #endif /* __QNX__ */
if ((event.key.keysym.unicode & 0xFF80) == 0) if ((event.key.keysym.unicode & 0xFF80) == 0)
{ {
sym = event.key.keysym.unicode & 0x7F; usym = event.key.keysym.unicode & 0x7F;
if (sym > 0 && sym < 32 && modstate & KMOD_CTRL) if (sym >= 32 && usym < 32 && modstate & KMOD_CTRL)
{
if (modstate & KMOD_SHIFT) if (modstate & KMOD_SHIFT)
sym += 64; usym += 64;
else sym += 96; else usym += 96;
}
sym = usym;
} }
/* else: it's an international character */ /* else: it's an international character */
} }