Commit 944af870 authored by Tomi Pakarinen's avatar Tomi Pakarinen Committed by CeRiAl

Finnish keyboard support

parent b2c7210d
......@@ -1075,6 +1075,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
: p->keyboard_lang == KBD_LANG_DK ? "dk"
: p->keyboard_lang == KBD_LANG_ES ? "es"
: p->keyboard_lang == KBD_LANG_US ? "us"
: p->keyboard_lang == KBD_LANG_FI ? "fi"
: p->keyboard_lang == KBD_LANG_SE ? "se"
: p->keyboard_lang == KBD_LANG_FR ? "fr"
: p->keyboard_lang == KBD_LANG_IT ? "it"
......@@ -1888,6 +1889,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
KbdLang l;
if ((l = KBD_LANG_DE, strcasecmp (value, "de") == 0)
|| (l = KBD_LANG_DK, strcasecmp (value, "dk") == 0)
|| (l = KBD_LANG_FI, strcasecmp (value, "fi") == 0)
|| (l = KBD_LANG_SE, strcasecmp (value, "se") == 0)
|| (l = KBD_LANG_US, strcasecmp (value, "us") == 0)
|| (l = KBD_LANG_FR, strcasecmp (value, "fr") == 0)
......@@ -3417,6 +3419,8 @@ int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg)
p->keyboard_lang = KBD_LANG_DK;
else if (0 == strcasecmp(arg, "us"))
p->keyboard_lang = KBD_LANG_US;
else if (0 == strcasecmp(arg, "fi"))
p->keyboard_lang = KBD_LANG_FI;
else if (0 == strcasecmp(arg, "se"))
p->keyboard_lang = KBD_LANG_SE;
else if (0 == strcasecmp(arg, "fr"))
......
......@@ -1349,7 +1349,7 @@ void handle_events (void)
keycode = rEvent.key.keysym.sym;
*/
keycode = rEvent.key.keysym.sym;
// write_log ("Event: key: %d to: %d %s\n", keycode, sdlk2dik (keycode), state ? "down" : "up");
//write_log ("Event: key: %d to: %d %s\n", keycode, sdlk2dik (keycode), state ? "down" : "up");
my_kbd_handler (0, sdlk2dik (keycode), state);
/*
if ((ievent = match_hotkey_sequence (keycode, state))) {
......
......@@ -286,6 +286,48 @@ static int decode_se (int keysym)
}
}
/*
* Handle keys specific to FI keymaps.
*/
static int decode_fi (int keysym)
{
switch (keysym) {
case SDLK_a: return AK_A;
case SDLK_m: return AK_M;
case SDLK_q: return AK_Q;
case SDLK_w: return AK_W;
case SDLK_y: return AK_Y;
case SDLK_z: return AK_Z;
case SDLK_WORLD_0: return AK_LBRACKET;
case SDLK_WORLD_1: return AK_QUOTE;
case SDLK_WORLD_2: return AK_LBRACKET;
case SDLK_WORLD_3: return AK_LBRACKET;
case SDLK_WORLD_4: return AK_LBRACKET;
case SDLK_WORLD_5: return AK_LBRACKET;
case SDLK_WORLD_86: return AK_SEMICOLON;
case SDLK_WORLD_68: return AK_QUOTE;
case SDLK_WORLD_69: return AK_LBRACKET;
case SDLK_COMMA: return AK_COMMA;
case SDLK_PERIOD: return AK_PERIOD;
case SDLK_MINUS: return AK_SLASH;
case SDLK_LESS:
case SDLK_GREATER: return AK_LTGT;
case SDLK_PLUS:
case SDLK_QUESTION: return AK_EQUAL;
case SDLK_AT:
case SDLK_WORLD_29: return AK_BACKQUOTE;
case SDLK_CARET: return AK_RBRACKET;
case SDLK_BACKSLASH: return AK_MINUS;
case SDLK_HASH: return AK_NUMBERSIGN;
default: return -1;
}
}
/*
* Handle keys specific to Italian keymaps.
*/
......@@ -360,6 +402,148 @@ static int decode_tr (int keysym)
}
}
int sdlk2dik (int keysym) {
switch (keysym) {
case SDLK_ESCAPE: return DIK_ESCAPE;
//
case SDLK_1: return DIK_1;
case SDLK_2: return DIK_2;
case SDLK_3: return DIK_3;
case SDLK_4: return DIK_4;
case SDLK_5: return DIK_5;
case SDLK_6: return DIK_6;
case SDLK_7: return DIK_7;
case SDLK_8: return DIK_8;
case SDLK_9: return DIK_9;
case SDLK_0: return DIK_0;
case SDLK_MINUS: return DIK_MINUS; //?*
case SDLK_EQUALS: return DIK_EQUALS; //-_
case SDLK_BACKSPACE: return DIK_BACK;
//
case SDLK_TAB: return DIK_TAB;
case SDLK_q: return DIK_Q;
case SDLK_w: return DIK_W;
case SDLK_e: return DIK_E;
case SDLK_r: return DIK_R;
case SDLK_t: return DIK_T;
case SDLK_y: return DIK_Y;
case SDLK_u: return DIK_U;
case SDLK_i: return DIK_I;
case SDLK_o: return DIK_O;
case SDLK_p: return DIK_P;
case SDLK_LEFTBRACKET: return DIK_LBRACKET; //tr kbd g
case SDLK_RIGHTBRACKET: return DIK_RBRACKET; //tr kbd u
case SDLK_RETURN: return DIK_RETURN;
case SDLK_LCTRL: return DIK_LCONTROL;
//
case SDLK_a: return DIK_A;
case SDLK_s: return DIK_S;
case SDLK_d: return DIK_D;
case SDLK_f: return DIK_F;
case SDLK_g: return DIK_G;
case SDLK_h: return DIK_H;
case SDLK_j: return DIK_J;
case SDLK_k: return DIK_K;
case SDLK_l: return DIK_L;
case SDLK_SEMICOLON: return DIK_SEMICOLON; //tr kbd s
// case SDLK_QUOTE: return DIK_APOSTROPHE; //tr kbd i
case SDLK_QUOTE: return DIK_NUMBERSIGN; //tr kbd i
// case SDLK_ return DIK_GRAVE; //tr kdb ;,
case SDLK_LSHIFT: return DIK_LSHIFT;
//
case SDLK_z: return DIK_Z;
case SDLK_x: return DIK_X;
case SDLK_c: return DIK_C;
case SDLK_v: return DIK_V;
case SDLK_b: return DIK_B;
case SDLK_n: return DIK_N;
case SDLK_m: return DIK_M;
case SDLK_COMMA: return DIK_COMMA; //tr kbd o
case SDLK_PERIOD: return DIK_PERIOD; //tr kbd c
case SDLK_SLASH: return DIK_SLASH; //tr kbd .
case SDLK_RSHIFT: return DIK_RSHIFT;
case SDLK_SPACE: return DIK_SPACE;
//
case SDLK_F1: return DIK_F1;
case SDLK_F2: return DIK_F2;
case SDLK_F3: return DIK_F3;
case SDLK_F4: return DIK_F4;
case SDLK_F5: return DIK_F5;
case SDLK_F6: return DIK_F6;
case SDLK_F7: return DIK_F7;
case SDLK_F8: return DIK_F8;
case SDLK_F9: return DIK_F9;
case SDLK_F10: return DIK_F10;
case SDLK_F11: return DIK_F11;
case SDLK_F12: return DIK_F12;
case SDLK_F13: return DIK_F13;
case SDLK_F14: return DIK_F14;
case SDLK_F15: return DIK_F15;
case SDLK_NUMLOCK: return DIK_NUMLOCK;
// case SDLK_CAPSLOCK: return DIK_CAPSLOCK;
case SDLK_CAPSLOCK: return DIK_CAPITAL;
case SDLK_SCROLLOCK: return DIK_SCROLL;
//
case SDLK_KP7: return DIK_NUMPAD7;
case SDLK_KP8: return DIK_NUMPAD8;
case SDLK_KP9: return DIK_NUMPAD9;
case SDLK_KP_MINUS: return DIK_SUBTRACT;
case SDLK_KP4: return DIK_NUMPAD4;
case SDLK_KP5: return DIK_NUMPAD5;
case SDLK_KP6: return DIK_NUMPAD6;
case SDLK_KP_PLUS: return DIK_ADD;
case SDLK_KP1: return DIK_NUMPAD1;
case SDLK_KP2: return DIK_NUMPAD2;
case SDLK_KP3: return DIK_NUMPAD3;
case SDLK_KP0: return DIK_NUMPAD0;
case SDLK_KP_PERIOD: return DIK_DECIMAL;
case SDLK_KP_ENTER: return DIK_NUMPADENTER;
case SDLK_KP_DIVIDE: return DIK_DIVIDE;
case SDLK_KP_MULTIPLY: return DIK_MULTIPLY;
case SDLK_KP_EQUALS: return DIK_NUMPADEQUALS;
case SDLK_DELETE: return DIK_DELETE;
case SDLK_RCTRL: return DIK_RCONTROL;
case SDLK_LALT: return DIK_LMENU;
case SDLK_RALT: return DIK_RMENU;
case SDLK_INSERT: return DIK_INSERT;
case SDLK_HOME: return DIK_HOME;
case SDLK_END: return DIK_END;
case SDLK_UP: return DIK_UP;
case SDLK_PAGEUP: return DIK_PRIOR;
case SDLK_LEFT: return DIK_LEFT;
case SDLK_RIGHT: return DIK_RIGHT;
case SDLK_DOWN: return DIK_DOWN;
case SDLK_PAGEDOWN: return DIK_NEXT;
/* case SDLK_RSUPER: return AK_RAMI;
case SDLK_LSUPER: return AK_LAMI;*/
case SDLK_PAUSE: return DIK_PAUSE;
// case SDLK_PRINT: return AKS_SCREENSHOT_FILE;
//here
case SDLK_LMETA: return DIK_LWIN; //mac LCMD
case SDLK_RMETA: return DIK_RWIN; //mac RCMD
// case SDLK_WORLD_0: return 0; //e"
case SDLK_PLUS: return DIK_EQUALS;
case SDLK_WORLD_0: return DIK_GRAVE;
case SDLK_WORLD_1: return DIK_BACKSLASH;
case SDLK_WORLD_2: return DIK_RBRACKET;
case SDLK_WORLD_3: return DIK_LBRACKET;
case SDLK_WORLD_4: return DIK_APOSTROPHE;
case SDLK_WORLD_5: return DIK_SEMICOLON;
case SDLK_LESS: return DIK_OEM_102;
// case SDLK_ASTERISK: return DIK_NUMBERSIGN;
default: return -1;
}
}
/*
*/
......@@ -377,6 +561,8 @@ int keysym2amiga (int keysym)
amiga_keycode = decode_de (keysym); break;
case KBD_LANG_DK:
amiga_keycode = decode_dk (keysym); break;
case KBD_LANG_FI:
amiga_keycode = decode_fi (keysym); break;
case KBD_LANG_SE:
amiga_keycode = decode_se (keysym); break;
case KBD_LANG_IT:
......
......@@ -240,6 +240,7 @@ DEFEVENT(KEY_LEFTBRACKET,"Left Bracket",AM_K,0,0,AK_LBRACKET)
DEFEVENT(KEY_RIGHTBRACKET,"Right Bracket",AM_K,0,0,AK_RBRACKET)
DEFEVENT(KEY_SEMICOLON,"Semicolon",AM_K,0,0,AK_SEMICOLON)
DEFEVENT(KEY_SINGLEQUOTE,"Single Quote",AM_K,0,0,AK_QUOTE)
DEFEVENT(KEY_NUMBERSIGN,"Number sign",AM_K,0,0,AK_NUMBERSIGN)
DEFEVENT(KEY_COMMA,"Comma",AM_K,0,0,AK_COMMA)
DEFEVENT(KEY_PERIOD,"Period",AM_K,0,0,AK_PERIOD)
DEFEVENT(KEY_DIV,"Slash",AM_K,0,0,AK_SLASH)
......
......@@ -256,6 +256,7 @@ static struct uae_input_device_kbr_default keytrans[] = {
{ DIK_RBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
{ DIK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
{ DIK_APOSTROPHE, INPUTEVENT_KEY_SINGLEQUOTE },
{ DIK_NUMBERSIGN, INPUTEVENT_KEY_NUMBERSIGN },
{ DIK_GRAVE, INPUTEVENT_KEY_BACKQUOTE },
{ DIK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
{ DIK_COMMA, INPUTEVENT_KEY_COMMA },
......
......@@ -82,6 +82,7 @@ enum {
UAEKEY_RIGHTBRACKET,
UAEKEY_SEMICOLON,
UAEKEY_SINGLEQUOTE,
UAEKEY_NUMBERSIGN,
UAEKEY_GRAVE,
UAEKEY_BACKSLASH,
UAEKEY_COMMA,
......@@ -307,6 +308,7 @@ struct uaekey_hostmap
#define DIK_MYCOMPUTER 0xEB /* My Computer */
#define DIK_MAIL 0xEC /* Mail */
#define DIK_MEDIASELECT 0xED /* Media Select */
#define DIK_NUMBERSIGN 0xEE
/* Alternate names for keys, to facilitate transition from DOS. */
#define DIK_BACKSPACE DIK_BACK /* backspace */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment