|
|
@ -882,41 +882,36 @@ bool Core::ncurses_wgetch(int in, int & out)
|
|
|
|
|
|
|
|
|
|
|
|
int Core::UnicodeAwareSym(const SDL::KeyboardEvent& ke)
|
|
|
|
int Core::UnicodeAwareSym(const SDL::KeyboardEvent& ke)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
con.print("Unicode came in as %d\n", ke.ksym.unicode);
|
|
|
|
// Assume keyboard layouts don't change the order of numbers:
|
|
|
|
// Assume keyboard layouts don't change the order of numbers:
|
|
|
|
if( '0' <= ke.ksym.sym && ke.ksym.sym <= '9') return ke.ksym.sym;
|
|
|
|
if( '0' <= ke.ksym.sym && ke.ksym.sym <= '9') return ke.ksym.sym;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int unicode = ke.ksym.unicode;
|
|
|
|
int unicode = ke.ksym.unicode;
|
|
|
|
|
|
|
|
|
|
|
|
// convert Ctrl characters to their 0x40-0x5F counterparts:
|
|
|
|
// convert Ctrl characters to their 0x40-0x5F counterparts:
|
|
|
|
if (unicode < ' ')
|
|
|
|
if (unicode < ' ')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
unicode += 'A' - 1;
|
|
|
|
unicode += 'A' - 1;
|
|
|
|
con.print("Unicode is a control character. Adding 0x40: %d\n", unicode);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// convert A-Z to their a-z counterparts:
|
|
|
|
// convert A-Z to their a-z counterparts:
|
|
|
|
if('A' < unicode && unicode < 'Z')
|
|
|
|
if('A' < unicode && unicode < 'Z')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
unicode += 'a' - 'A';
|
|
|
|
unicode += 'a' - 'A';
|
|
|
|
con.print("Unicode is a upper case. Subtracting 0x20: %d\n", unicode);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// convert various other punctuation marks:
|
|
|
|
// convert various other punctuation marks:
|
|
|
|
if('\"' == unicode) unicode = '\'';
|
|
|
|
if('\"' == unicode) unicode = '\'';
|
|
|
|
if('+' == unicode) unicode = '=';
|
|
|
|
if('+' == unicode) unicode = '=';
|
|
|
|
if(':' == unicode) unicode = ';';
|
|
|
|
if(':' == unicode) unicode = ';';
|
|
|
|
if('<' == unicode) unicode = ',';
|
|
|
|
if('<' == unicode) unicode = ',';
|
|
|
|
if('>' == unicode) unicode = '.';
|
|
|
|
if('>' == unicode) unicode = '.';
|
|
|
|
if('?' == unicode) unicode = '/';
|
|
|
|
if('?' == unicode) unicode = '/';
|
|
|
|
if('{' == unicode) unicode = '[';
|
|
|
|
if('{' == unicode) unicode = '[';
|
|
|
|
if('|' == unicode) unicode = '\\';
|
|
|
|
if('|' == unicode) unicode = '\\';
|
|
|
|
if('}' == unicode) unicode = ']';
|
|
|
|
if('}' == unicode) unicode = ']';
|
|
|
|
if('~' == unicode) unicode = '`';
|
|
|
|
if('~' == unicode) unicode = '`';
|
|
|
|
|
|
|
|
|
|
|
|
con.print("Unicode punctuation filter. Now: %d\n", unicode);
|
|
|
|
return unicode;
|
|
|
|
|
|
|
|
|
|
|
|
return unicode;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//MEMO: return false if event is consumed
|
|
|
|
//MEMO: return false if event is consumed
|
|
|
@ -943,8 +938,7 @@ int Core::SDL_Event(SDL::Event* ev)
|
|
|
|
// user's Input Language
|
|
|
|
// user's Input Language
|
|
|
|
if((ke->ksym.unicode & 0xff80) == 0)
|
|
|
|
if((ke->ksym.unicode & 0xff80) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int key = UnicodeAwareSym(*ke);
|
|
|
|
int key = UnicodeAwareSym(*ke);
|
|
|
|
|
|
|
|
SelectHotkey(key, mod);
|
|
|
|
SelectHotkey(key, mod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|