diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c index 3eb671230bb850ab8d6452da2677417655597971..5a1da94de0ed8df7f1859e6850669b6d1e91c64f 100644 --- a/src/conio/sdl_con.c +++ b/src/conio/sdl_con.c @@ -1599,45 +1599,46 @@ unsigned int cp437_convert(unsigned int unicode) /* Called from event thread only */ unsigned int sdl_get_char_code(unsigned int keysym, unsigned int mod, unsigned int unicode) { + int expect; + int i; + #ifdef __DARWIN__ if(unicode==0x7f) { unicode=0x08; keysym=SDLK_BACKSPACE; } #endif - if(!unicode || (mod & (KMOD_META|KMOD_ALT))) { - int expect; - int i; - - for(i=0;sdl_keyval[i].keysym;i++) { - if(sdl_keyval[i].keysym==keysym) { - if(mod & KMOD_CTRL) - expect=sdl_keyval[i].ctrl; - else if(mod & KMOD_SHIFT) - expect=sdl_keyval[i].shift; - else - expect=sdl_keyval[i].key; - - /* "Extended" syms are always right */ - if(!unicode) - return(expect); - if(sdl_keyval[i].key > 255) - return(expect); - /* - * If we don't know that this key can - * return the unicode translation, then - * we're not right and this is prolly - * an AltGr sequence. - */ - if(mod & (KMOD_META|KMOD_ALT)) { - if(unicode==expect) - return(sdl_keyval[i].alt); - } + for(i=0;sdl_keyval[i].keysym;i++) { + if(sdl_keyval[i].keysym==keysym) { + if(mod & KMOD_CTRL) + expect=sdl_keyval[i].ctrl; + else if(mod & KMOD_SHIFT) + expect=sdl_keyval[i].shift; + else + expect=sdl_keyval[i].key; + + /* "Extended" syms are always right */ + if(!unicode) + return(expect); + if(sdl_keyval[i].key > 255) + return(expect); + /* + * If we don't know that this key can + * return the unicode translation, then + * we're not right and this is prolly + * an AltGr sequence. + */ + if(mod & (KMOD_META|KMOD_ALT)) { + if(unicode==expect) + return(sdl_keyval[i].alt); } + else + return(expect); } + } + if(!unicode || (mod & (KMOD_META|KMOD_ALT))) return(0x0001ffff); - } if(unicode <= 0x7f) return(unicode); return(cp437_convert(unicode));