|
|
@ -96,168 +96,294 @@ static int mapkey(int androidkey)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(androidkey)
|
|
|
|
switch(androidkey)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// case AKEYCODE_SOFT_LEFT: return K_;
|
|
|
|
case AKEYCODE_SOFT_LEFT: return K_LEFTARROW;
|
|
|
|
// case AKEYCODE_SOFT_RIGHT: return K_;
|
|
|
|
case AKEYCODE_SOFT_RIGHT: return K_RIGHTARROW;
|
|
|
|
// case AKEYCODE_HOME: return K_;
|
|
|
|
case AKEYCODE_HOME: return K_HOME; //not quite right, but w/e
|
|
|
|
// case AKEYCODE_BACK: return K_;
|
|
|
|
case AKEYCODE_BACK: return K_ESCAPE;
|
|
|
|
// case AKEYCODE_CALL: return K_;
|
|
|
|
// case AKEYCODE_CALL: return K_;
|
|
|
|
// case AKEYCODE_ENDCALL: return K_;
|
|
|
|
// case AKEYCODE_ENDCALL: return K_;
|
|
|
|
case AKEYCODE_0: return '0';
|
|
|
|
case AKEYCODE_0: return '0';
|
|
|
|
case AKEYCODE_1: return '1';
|
|
|
|
case AKEYCODE_1: return '1';
|
|
|
|
case AKEYCODE_2: return '2';
|
|
|
|
case AKEYCODE_2: return '2';
|
|
|
|
case AKEYCODE_3: return '3';
|
|
|
|
case AKEYCODE_3: return '3';
|
|
|
|
case AKEYCODE_4: return '4';
|
|
|
|
case AKEYCODE_4: return '4';
|
|
|
|
case AKEYCODE_5: return '5';
|
|
|
|
case AKEYCODE_5: return '5';
|
|
|
|
case AKEYCODE_6: return '6';
|
|
|
|
case AKEYCODE_6: return '6';
|
|
|
|
case AKEYCODE_7: return '7';
|
|
|
|
case AKEYCODE_7: return '7';
|
|
|
|
case AKEYCODE_8: return '8';
|
|
|
|
case AKEYCODE_8: return '8';
|
|
|
|
case AKEYCODE_9: return '9';
|
|
|
|
case AKEYCODE_9: return '9';
|
|
|
|
// case AKEYCODE_STAR: return K_;
|
|
|
|
case AKEYCODE_STAR: return '*';
|
|
|
|
// case AKEYCODE_POUND: return K_; //americans don't know what a pound symbol looks like.
|
|
|
|
case AKEYCODE_POUND: return '#'; //americans don't know what a pound symbol looks like.
|
|
|
|
case AKEYCODE_DPAD_UP: return K_GP_DPAD_UP;
|
|
|
|
case AKEYCODE_DPAD_UP: return K_GP_DPAD_UP;
|
|
|
|
case AKEYCODE_DPAD_DOWN: return K_GP_DPAD_DOWN;
|
|
|
|
case AKEYCODE_DPAD_DOWN: return K_GP_DPAD_DOWN;
|
|
|
|
case AKEYCODE_DPAD_LEFT: return K_GP_DPAD_LEFT;
|
|
|
|
case AKEYCODE_DPAD_LEFT: return K_GP_DPAD_LEFT;
|
|
|
|
case AKEYCODE_DPAD_RIGHT: return K_GP_DPAD_RIGHT;
|
|
|
|
case AKEYCODE_DPAD_RIGHT: return K_GP_DPAD_RIGHT;
|
|
|
|
case AKEYCODE_DPAD_CENTER: return K_ENTER;
|
|
|
|
case AKEYCODE_DPAD_CENTER: return K_ENTER;
|
|
|
|
case AKEYCODE_VOLUME_UP: return K_VOLUP;
|
|
|
|
case AKEYCODE_VOLUME_UP: return K_VOLUP;
|
|
|
|
case AKEYCODE_VOLUME_DOWN: return K_VOLDOWN;
|
|
|
|
case AKEYCODE_VOLUME_DOWN: return K_VOLDOWN;
|
|
|
|
case AKEYCODE_POWER: return K_POWER;
|
|
|
|
case AKEYCODE_POWER: return K_POWER;
|
|
|
|
// case AKEYCODE_CAMERA: return K_CAMERA;
|
|
|
|
// case AKEYCODE_CAMERA: return K_CAMERA;
|
|
|
|
// case AKEYCODE_CLEAR: return K_;
|
|
|
|
// case AKEYCODE_CLEAR: return K_;
|
|
|
|
case AKEYCODE_A: return 'a';
|
|
|
|
case AKEYCODE_A: return 'a';
|
|
|
|
case AKEYCODE_B: return 'b';
|
|
|
|
case AKEYCODE_B: return 'b';
|
|
|
|
case AKEYCODE_C: return 'c';
|
|
|
|
case AKEYCODE_C: return 'c';
|
|
|
|
case AKEYCODE_D: return 'd';
|
|
|
|
case AKEYCODE_D: return 'd';
|
|
|
|
case AKEYCODE_E: return 'e';
|
|
|
|
case AKEYCODE_E: return 'e';
|
|
|
|
case AKEYCODE_F: return 'f';
|
|
|
|
case AKEYCODE_F: return 'f';
|
|
|
|
case AKEYCODE_G: return 'g';
|
|
|
|
case AKEYCODE_G: return 'g';
|
|
|
|
case AKEYCODE_H: return 'h';
|
|
|
|
case AKEYCODE_H: return 'h';
|
|
|
|
case AKEYCODE_I: return 'i';
|
|
|
|
case AKEYCODE_I: return 'i';
|
|
|
|
case AKEYCODE_J: return 'j';
|
|
|
|
case AKEYCODE_J: return 'j';
|
|
|
|
case AKEYCODE_K: return 'k';
|
|
|
|
case AKEYCODE_K: return 'k';
|
|
|
|
case AKEYCODE_L: return 'l';
|
|
|
|
case AKEYCODE_L: return 'l';
|
|
|
|
case AKEYCODE_M: return 'm';
|
|
|
|
case AKEYCODE_M: return 'm';
|
|
|
|
case AKEYCODE_N: return 'n';
|
|
|
|
case AKEYCODE_N: return 'n';
|
|
|
|
case AKEYCODE_O: return 'o';
|
|
|
|
case AKEYCODE_O: return 'o';
|
|
|
|
case AKEYCODE_P: return 'p';
|
|
|
|
case AKEYCODE_P: return 'p';
|
|
|
|
case AKEYCODE_Q: return 'q';
|
|
|
|
case AKEYCODE_Q: return 'q';
|
|
|
|
case AKEYCODE_R: return 'r';
|
|
|
|
case AKEYCODE_R: return 'r';
|
|
|
|
case AKEYCODE_S: return 's';
|
|
|
|
case AKEYCODE_S: return 's';
|
|
|
|
case AKEYCODE_T: return 't';
|
|
|
|
case AKEYCODE_T: return 't';
|
|
|
|
case AKEYCODE_U: return 'u';
|
|
|
|
case AKEYCODE_U: return 'u';
|
|
|
|
case AKEYCODE_V: return 'v';
|
|
|
|
case AKEYCODE_V: return 'v';
|
|
|
|
case AKEYCODE_W: return 'w';
|
|
|
|
case AKEYCODE_W: return 'w';
|
|
|
|
case AKEYCODE_X: return 'x';
|
|
|
|
case AKEYCODE_X: return 'x';
|
|
|
|
case AKEYCODE_Y: return 'y';
|
|
|
|
case AKEYCODE_Y: return 'y';
|
|
|
|
case AKEYCODE_Z: return 'z';
|
|
|
|
case AKEYCODE_Z: return 'z';
|
|
|
|
case AKEYCODE_COMMA: return ',';
|
|
|
|
case AKEYCODE_COMMA: return ',';
|
|
|
|
case AKEYCODE_PERIOD: return '.';
|
|
|
|
case AKEYCODE_PERIOD: return '.';
|
|
|
|
case AKEYCODE_ALT_LEFT: return K_LALT;
|
|
|
|
case AKEYCODE_ALT_LEFT: return K_LALT;
|
|
|
|
case AKEYCODE_ALT_RIGHT: return K_RALT;
|
|
|
|
case AKEYCODE_ALT_RIGHT: return K_RALT;
|
|
|
|
case AKEYCODE_SHIFT_LEFT: return K_LSHIFT;
|
|
|
|
case AKEYCODE_SHIFT_LEFT: return K_LSHIFT;
|
|
|
|
case AKEYCODE_SHIFT_RIGHT: return K_RSHIFT;
|
|
|
|
case AKEYCODE_SHIFT_RIGHT: return K_RSHIFT;
|
|
|
|
case AKEYCODE_TAB : return K_TAB;
|
|
|
|
case AKEYCODE_TAB: return K_TAB;
|
|
|
|
case AKEYCODE_SPACE: return K_SPACE;
|
|
|
|
case AKEYCODE_SPACE: return K_SPACE;
|
|
|
|
// case AKEYCODE_SYM: return K_;
|
|
|
|
// case AKEYCODE_SYM: return K_IMEMODE_SYMBOL;
|
|
|
|
// case AKEYCODE_EXPLORER : return K_;
|
|
|
|
// case AKEYCODE_EXPLORER: return K_MM_APP_FILES;
|
|
|
|
// case AKEYCODE_ENVELOPE: return K_;
|
|
|
|
// case AKEYCODE_ENVELOPE: return K_MM_APP_EMAIL;
|
|
|
|
case AKEYCODE_ENTER: return K_ENTER;
|
|
|
|
case AKEYCODE_ENTER: return K_ENTER;
|
|
|
|
case AKEYCODE_DEL: return K_BACKSPACE;
|
|
|
|
case AKEYCODE_DEL: return K_BACKSPACE;
|
|
|
|
case AKEYCODE_GRAVE: return '`';
|
|
|
|
case AKEYCODE_GRAVE: return '`';
|
|
|
|
case AKEYCODE_MINUS: return '-';
|
|
|
|
case AKEYCODE_MINUS: return '-';
|
|
|
|
case AKEYCODE_EQUALS: return '=';
|
|
|
|
case AKEYCODE_EQUALS: return '=';
|
|
|
|
case AKEYCODE_LEFT_BRACKET: return '[';
|
|
|
|
case AKEYCODE_LEFT_BRACKET: return '[';
|
|
|
|
case AKEYCODE_RIGHT_BRACKET: return ']';
|
|
|
|
case AKEYCODE_RIGHT_BRACKET:return ']';
|
|
|
|
case AKEYCODE_BACKSLASH: return '#'; //this kinda sums up keymaps like this.
|
|
|
|
case AKEYCODE_BACKSLASH: return '#'; //this kinda sums up keymaps like this.
|
|
|
|
case AKEYCODE_SEMICOLON: return ';';
|
|
|
|
case AKEYCODE_SEMICOLON: return ';';
|
|
|
|
case AKEYCODE_APOSTROPHE: return '\'';
|
|
|
|
case AKEYCODE_APOSTROPHE: return '\'';
|
|
|
|
case AKEYCODE_SLASH: return '/';
|
|
|
|
case AKEYCODE_SLASH: return '/';
|
|
|
|
// case AKEYCODE_AT: return K_;
|
|
|
|
case AKEYCODE_AT: return '@';
|
|
|
|
// case AKEYCODE_NUM: return K_;
|
|
|
|
// case AKEYCODE_NUM: return K_;
|
|
|
|
// case AKEYCODE_HEADSETHOOK: return K_;
|
|
|
|
// case AKEYCODE_HEADSETHOOK: return K_;
|
|
|
|
// case AKEYCODE_FOCUS: return K_;
|
|
|
|
// case AKEYCODE_FOCUS: return K_CAMERAFOCUS;
|
|
|
|
// case AKEYCODE_PLUS: return K_;
|
|
|
|
case AKEYCODE_PLUS: return '+';
|
|
|
|
case AKEYCODE_MENU: return K_APP;
|
|
|
|
case AKEYCODE_MENU: return K_APP;
|
|
|
|
// case AKEYCODE_NOTIFICATION: return K_;
|
|
|
|
// case AKEYCODE_NOTIFICATION: return K_;
|
|
|
|
case AKEYCODE_SEARCH: return K_SEARCH;
|
|
|
|
case AKEYCODE_SEARCH: return K_SEARCH;
|
|
|
|
// case AKEYCODE_MEDIA_PLAY_PAUSE: return K_;
|
|
|
|
case AKEYCODE_MEDIA_PLAY_PAUSE: return K_MM_TRACK_PLAYPAUSE;
|
|
|
|
// case AKEYCODE_MEDIA_STOP: return K_;
|
|
|
|
case AKEYCODE_MEDIA_STOP: return K_MM_TRACK_STOP;
|
|
|
|
// case AKEYCODE_MEDIA_NEXT: return K_;
|
|
|
|
case AKEYCODE_MEDIA_NEXT: return K_MM_TRACK_NEXT;
|
|
|
|
// case AKEYCODE_MEDIA_PREVIOUS: return K_;
|
|
|
|
case AKEYCODE_MEDIA_PREVIOUS: return K_MM_TRACK_PREV;
|
|
|
|
// case AKEYCODE_MEDIA_REWIND: return K_;
|
|
|
|
// case AKEYCODE_MEDIA_REWIND: return K_MM_TRACK_REWIND;
|
|
|
|
// case AKEYCODE_MEDIA_FAST_FORWARD: return K_;
|
|
|
|
// case AKEYCODE_MEDIA_FAST_FORWARD: return K_MM_TRACK_FASTFWD;
|
|
|
|
// case AKEYCODE_MUTE: return K_;
|
|
|
|
case AKEYCODE_MUTE: return K_MM_VOLUME_MUTE;
|
|
|
|
case AKEYCODE_PAGE_UP: return K_PGUP;
|
|
|
|
case AKEYCODE_PAGE_UP: return K_PGUP;
|
|
|
|
case AKEYCODE_PAGE_DOWN: return K_PGDN;
|
|
|
|
case AKEYCODE_PAGE_DOWN: return K_PGDN;
|
|
|
|
// case AKEYCODE_PICTSYMBOLS: return K_;
|
|
|
|
// case AKEYCODE_PICTSYMBOLS: return K_IMEMODE_EMOJI;
|
|
|
|
// case AKEYCODE_SWITCH_CHARSET: return K_;
|
|
|
|
// case AKEYCODE_SWITCH_CHARSET: return K_IMEMODE_CHARSET;
|
|
|
|
case AKEYCODE_BUTTON_A: return K_GP_A;
|
|
|
|
case AKEYCODE_BUTTON_A: return K_GP_A;
|
|
|
|
case AKEYCODE_BUTTON_B: return K_GP_B;
|
|
|
|
case AKEYCODE_BUTTON_B: return K_GP_B;
|
|
|
|
// case AKEYCODE_BUTTON_C: return K_GP_C;
|
|
|
|
// case AKEYCODE_BUTTON_C: return K_GP_C;
|
|
|
|
case AKEYCODE_BUTTON_X: return K_GP_X;
|
|
|
|
case AKEYCODE_BUTTON_X: return K_GP_X;
|
|
|
|
case AKEYCODE_BUTTON_Y: return K_GP_Y;
|
|
|
|
case AKEYCODE_BUTTON_Y: return K_GP_Y;
|
|
|
|
// case AKEYCODE_BUTTON_Z: return K_GP_Z;
|
|
|
|
// case AKEYCODE_BUTTON_Z: return K_GP_Z;
|
|
|
|
case AKEYCODE_BUTTON_L1: return K_GP_LEFT_SHOULDER;
|
|
|
|
case AKEYCODE_BUTTON_L1: return K_GP_LEFT_SHOULDER;
|
|
|
|
case AKEYCODE_BUTTON_R1: return K_GP_RIGHT_SHOULDER;
|
|
|
|
case AKEYCODE_BUTTON_R1: return K_GP_RIGHT_SHOULDER;
|
|
|
|
case AKEYCODE_BUTTON_L2: return K_GP_LEFT_TRIGGER;
|
|
|
|
case AKEYCODE_BUTTON_L2: return K_GP_LEFT_TRIGGER;
|
|
|
|
case AKEYCODE_BUTTON_R2: return K_GP_RIGHT_TRIGGER;
|
|
|
|
case AKEYCODE_BUTTON_R2: return K_GP_RIGHT_TRIGGER;
|
|
|
|
case AKEYCODE_BUTTON_THUMBL: return K_GP_LEFT_THUMB;
|
|
|
|
case AKEYCODE_BUTTON_THUMBL: return K_GP_LEFT_THUMB;
|
|
|
|
case AKEYCODE_BUTTON_THUMBR: return K_GP_RIGHT_THUMB;
|
|
|
|
case AKEYCODE_BUTTON_THUMBR: return K_GP_RIGHT_THUMB;
|
|
|
|
case AKEYCODE_BUTTON_START: return K_GP_START;
|
|
|
|
case AKEYCODE_BUTTON_START: return K_GP_START;
|
|
|
|
case AKEYCODE_BUTTON_SELECT: return K_GP_BACK;
|
|
|
|
case AKEYCODE_BUTTON_SELECT: return K_GP_BACK;
|
|
|
|
case AKEYCODE_BUTTON_MODE: return K_GP_GUIDE;
|
|
|
|
case AKEYCODE_BUTTON_MODE: return K_GP_GUIDE;
|
|
|
|
|
|
|
|
|
|
|
|
//And this is the part where you start to see quite why I hate android so much
|
|
|
|
//And this is the part where you start to see quite why I hate android so much
|
|
|
|
case 111: return K_ESCAPE;
|
|
|
|
case 111/*AKEYCODE_ESCAPE*/: return K_ESCAPE;
|
|
|
|
case 112: return K_DEL;
|
|
|
|
case 112/*AKEYCODE_FORWARD_DEL*/: return K_DEL;
|
|
|
|
case 113: return K_LCTRL;
|
|
|
|
case 113/*AKEYCODE_CTRL_LEFT*/: return K_LCTRL;
|
|
|
|
case 114: return K_RCTRL;
|
|
|
|
case 114/*AKEYCODE_CTRL_RIGHT*/: return K_RCTRL;
|
|
|
|
case 115: return K_CAPSLOCK;
|
|
|
|
case 115/*AKEYCODE_CAPS_LOCK*/: return K_CAPSLOCK;
|
|
|
|
case 116: return K_SCRLCK;
|
|
|
|
case 116/*AKEYCODE_SCROLL_LOCK*/: return K_SCRLCK;
|
|
|
|
case 117: return K_LWIN;
|
|
|
|
case 117/*AKEYCODE_META_LEFT*/: return K_LWIN;
|
|
|
|
case 118: return K_RWIN;
|
|
|
|
case 118/*AKEYCODE_META_RIGHT*/: return K_RWIN;
|
|
|
|
// case 119: return K_FUNCTION;
|
|
|
|
// case 119/*AKEYCODE_FUNCTION*/: return K_FUNCTION;
|
|
|
|
// case 120: return K_SYSRQ;
|
|
|
|
// case 120/*AKEYCODE_SYSRQ*/: return K_SYSRQ;
|
|
|
|
case 121: return K_PAUSE;
|
|
|
|
case 121/*AKEYCODE_BREAK*/: return K_PAUSE;
|
|
|
|
case 122: return K_HOME;
|
|
|
|
case 122/*AKEYCODE_MOVE_HOME*/: return K_HOME;
|
|
|
|
case 123: return K_END;
|
|
|
|
case 123/*AKEYCODE_MOVE_END*/: return K_END;
|
|
|
|
case 124: return K_INS;
|
|
|
|
case 124/*AKEYCODE_INSERT*/: return K_INS;
|
|
|
|
// case 125: return K_FORWARD;
|
|
|
|
// case 125/*AKEYCODE_FORWARD*/: return K_FORWARD;
|
|
|
|
// case 126: return K_MEDIA_PLAY;
|
|
|
|
// case 126/*AKEYCODE_MEDIA_PLAY*/: return K_MEDIA_PLAY;
|
|
|
|
// case 127: return K_MEDIA_PAUSE;
|
|
|
|
// case 127/*AKEYCODE_MEDIA_PAUSE*/: return K_MEDIA_PAUSE;
|
|
|
|
// case 128: return K_MEDIA_CLOSE;
|
|
|
|
// case 128/*AKEYCODE_MEDIA_CLOSE*/: return K_MEDIA_CLOSE;
|
|
|
|
// case 129: return K_MEDIA_EJECT;
|
|
|
|
// case 129/*AKEYCODE_MEDIA_EJECT*/: return K_MEDIA_EJECT;
|
|
|
|
// case 130: return K_MEDIA_RECORD;
|
|
|
|
// case 130/*AKEYCODE_MEDIA_RECORD*/: return K_MEDIA_RECORD;
|
|
|
|
case 131: return K_F1;
|
|
|
|
case 131/*AKEYCODE_F1*/: return K_F1;
|
|
|
|
case 132: return K_F2;
|
|
|
|
case 132/*AKEYCODE_F2*/: return K_F2;
|
|
|
|
case 133: return K_F3;
|
|
|
|
case 133/*AKEYCODE_F3*/: return K_F3;
|
|
|
|
case 134: return K_F4;
|
|
|
|
case 134/*AKEYCODE_F4*/: return K_F4;
|
|
|
|
case 135: return K_F5;
|
|
|
|
case 135/*AKEYCODE_F5*/: return K_F5;
|
|
|
|
case 136: return K_F6;
|
|
|
|
case 136/*AKEYCODE_F6*/: return K_F6;
|
|
|
|
case 137: return K_F7;
|
|
|
|
case 137/*AKEYCODE_F7*/: return K_F7;
|
|
|
|
case 138: return K_F8;
|
|
|
|
case 138/*AKEYCODE_F8*/: return K_F8;
|
|
|
|
case 139: return K_F9;
|
|
|
|
case 139/*AKEYCODE_F9*/: return K_F9;
|
|
|
|
case 140: return K_F10;
|
|
|
|
case 140/*AKEYCODE_F10*/: return K_F10;
|
|
|
|
case 141: return K_F11;
|
|
|
|
case 141/*AKEYCODE_F11*/: return K_F11;
|
|
|
|
case 142: return K_F12;
|
|
|
|
case 142/*AKEYCODE_F12*/: return K_F12;
|
|
|
|
case 143: return K_KP_NUMLOCK;
|
|
|
|
case 143/*AKEYCODE_NUM_LOCK*/: return K_KP_NUMLOCK;
|
|
|
|
case 144: return K_KP_INS;
|
|
|
|
case 144/*AKEYCODE_NUMPAD_0*/: return K_KP_INS;
|
|
|
|
case 145: return K_KP_END;
|
|
|
|
case 145/*AKEYCODE_NUMPAD_1*/: return K_KP_END;
|
|
|
|
case 146: return K_KP_DOWNARROW;
|
|
|
|
case 146/*AKEYCODE_NUMPAD_2*/: return K_KP_DOWNARROW;
|
|
|
|
case 147: return K_KP_PGDN;
|
|
|
|
case 147/*AKEYCODE_NUMPAD_3*/: return K_KP_PGDN;
|
|
|
|
case 148: return K_KP_LEFTARROW;
|
|
|
|
case 148/*AKEYCODE_NUMPAD_4*/: return K_KP_LEFTARROW;
|
|
|
|
case 149: return K_KP_5;
|
|
|
|
case 149/*AKEYCODE_NUMPAD_5*/: return K_KP_5;
|
|
|
|
case 150: return K_KP_RIGHTARROW;
|
|
|
|
case 150/*AKEYCODE_NUMPAD_6*/: return K_KP_RIGHTARROW;
|
|
|
|
case 151: return K_KP_HOME;
|
|
|
|
case 151/*AKEYCODE_NUMPAD_7*/: return K_KP_HOME;
|
|
|
|
case 152: return K_KP_UPARROW;
|
|
|
|
case 152/*AKEYCODE_NUMPAD_8*/: return K_KP_UPARROW;
|
|
|
|
case 153: return K_KP_PGUP;
|
|
|
|
case 153/*AKEYCODE_NUMPAD_9*/: return K_KP_PGUP;
|
|
|
|
case 154: return K_KP_SLASH;
|
|
|
|
case 154/*AKEYCODE_NUMPAD_DIVIDE*/: return K_KP_SLASH;
|
|
|
|
case 155: return K_KP_STAR;
|
|
|
|
case 155/*AKEYCODE_NUMPAD_MULTIPLY*/: return K_KP_STAR;
|
|
|
|
case 156: return K_KP_MINUS;
|
|
|
|
case 156/*AKEYCODE_NUMPAD_SUBTRACT*/: return K_KP_MINUS;
|
|
|
|
case 157: return K_KP_PLUS;
|
|
|
|
case 157/*AKEYCODE_NUMPAD_ADD*/: return K_KP_PLUS;
|
|
|
|
case 158: return K_KP_DEL;
|
|
|
|
case 158/*AKEYCODE_NUMPAD_DOT*/: return K_KP_DEL;
|
|
|
|
case 160: return K_KP_ENTER;
|
|
|
|
// case 159/*AKEYCODE_NUMPAD_COMMA*/: return K_KP_COMMA;
|
|
|
|
|
|
|
|
case 160/*AKEYCODE_NUMPAD_ENTER*/: return K_KP_ENTER;
|
|
|
|
|
|
|
|
case 161/*AKEYCODE_NUMPAD_EQUALS*/: return K_KP_EQUALS;
|
|
|
|
|
|
|
|
// case 162/*AKEYCODE_NUMPAD_LEFT_PAREN*/: return K_KP_;
|
|
|
|
|
|
|
|
// case 163/*AKEYCODE_NUMPAD_RIGHT_PAREN*/:return K_KP_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// case 164/*AKEYCODE_VOLUME_MUTE*/: return K_;
|
|
|
|
|
|
|
|
// case 165/*AKEYCODE_INFO*/: return K_;
|
|
|
|
|
|
|
|
// case 166/*AKEYCODE_CHANNEL_UP*/: return K_;
|
|
|
|
|
|
|
|
// case 167/*AKEYCODE_CHANNEL_DOWN*/: return K_;
|
|
|
|
|
|
|
|
// case 168/*AKEYCODE_ZOOM_IN*/: return K_;
|
|
|
|
|
|
|
|
// case 169/*AKEYCODE_ZOOM_OUT*/: return K_;
|
|
|
|
|
|
|
|
// case 170/*AKEYCODE_TV*/: return K_;
|
|
|
|
|
|
|
|
// case 171/*AKEYCODE_WINDOW*/: return K_;
|
|
|
|
|
|
|
|
// case 172/*AKEYCODE_GUIDE*/: return K_;
|
|
|
|
|
|
|
|
// case 173/*AKEYCODE_DVR*/: return K_;
|
|
|
|
|
|
|
|
// case 174/*AKEYCODE_BOOKMARK*/: return K_;
|
|
|
|
|
|
|
|
// case 175/*AKEYCODE_CAPTIONS*/: return K_;
|
|
|
|
|
|
|
|
// case 176/*AKEYCODE_SETTINGS*/: return K_;
|
|
|
|
|
|
|
|
// case 177/*AKEYCODE_TV_POWER*/: return K_;
|
|
|
|
|
|
|
|
// case 178/*AKEYCODE_TV_INPUT*/: return K_;
|
|
|
|
|
|
|
|
// case 179/*AKEYCODE_STB_POWER*/: return K_;
|
|
|
|
|
|
|
|
// case 180/*AKEYCODE_STB_INPUT*/: return K_;
|
|
|
|
|
|
|
|
// case 181/*AKEYCODE_AVR_POWER*/: return K_;
|
|
|
|
|
|
|
|
// case 182/*AKEYCODE_AVR_INPUT*/: return K_;
|
|
|
|
|
|
|
|
// case 183/*AKEYCODE_PROG_RED*/: return K_;
|
|
|
|
|
|
|
|
// case 184/*AKEYCODE_PROG_GREEN*/: return K_;
|
|
|
|
|
|
|
|
// case 185/*AKEYCODE_PROG_YELLOW*/: return K_;
|
|
|
|
|
|
|
|
// case 186/*AKEYCODE_PROG_BLUE*/: return K_;
|
|
|
|
|
|
|
|
// case 187/*AKEYCODE_APP_SWITCH*/: return K_;
|
|
|
|
|
|
|
|
case 188/*AKEYCODE_BUTTON_1*/: return K_AUX1;
|
|
|
|
|
|
|
|
case 189/*AKEYCODE_BUTTON_2*/: return K_AUX2;
|
|
|
|
|
|
|
|
case 190/*AKEYCODE_BUTTON_3*/: return K_AUX3;
|
|
|
|
|
|
|
|
case 191/*AKEYCODE_BUTTON_4*/: return K_AUX4;
|
|
|
|
|
|
|
|
case 192/*AKEYCODE_BUTTON_5*/: return K_AUX5;
|
|
|
|
|
|
|
|
case 193/*AKEYCODE_BUTTON_6*/: return K_AUX6;
|
|
|
|
|
|
|
|
case 194/*AKEYCODE_BUTTON_7*/: return K_AUX7;
|
|
|
|
|
|
|
|
case 195/*AKEYCODE_BUTTON_8*/: return K_AUX8;
|
|
|
|
|
|
|
|
case 196/*AKEYCODE_BUTTON_9*/: return K_AUX9;
|
|
|
|
|
|
|
|
case 197/*AKEYCODE_BUTTON_10*/: return K_AUX10;
|
|
|
|
|
|
|
|
case 198/*AKEYCODE_BUTTON_11*/: return K_AUX11;
|
|
|
|
|
|
|
|
case 199/*AKEYCODE_BUTTON_12*/: return K_AUX12;
|
|
|
|
|
|
|
|
case 200/*AKEYCODE_BUTTON_13*/: return K_AUX13;
|
|
|
|
|
|
|
|
case 201/*AKEYCODE_BUTTON_14*/: return K_AUX14;
|
|
|
|
|
|
|
|
case 202/*AKEYCODE_BUTTON_15*/: return K_AUX15;
|
|
|
|
|
|
|
|
case 203/*AKEYCODE_BUTTON_16*/: return K_AUX16;
|
|
|
|
|
|
|
|
// case 204/*AKEYCODE_LANGUAGE_SWITCH*/: return K_; //like shift+space
|
|
|
|
|
|
|
|
// case 205/*AKEYCODE_MANNER_MODE*/: return K_; //toggles silent-mode
|
|
|
|
|
|
|
|
// case 206/*AKEYCODE_3D_MODE*/: return K_;
|
|
|
|
|
|
|
|
// case 207/*AKEYCODE_CONTACTS*/: return K_MM_APP_CONTACTS;
|
|
|
|
|
|
|
|
// case 208/*AKEYCODE_CALENDAR*/: return K_MM_APP_CALENDAR;
|
|
|
|
|
|
|
|
// case 209/*AKEYCODE_MUSIC*/: return K_MM_APP_MUSIC;
|
|
|
|
|
|
|
|
// case 210/*AKEYCODE_CALCULATOR*/: return K_MM_APP_CALCULATOR;
|
|
|
|
|
|
|
|
// case 211/*AKEYCODE_ZENKAKU_HANKAKU*/: return K_IME_;
|
|
|
|
|
|
|
|
// case 212/*AKEYCODE_EISU*/: return K_IME_;
|
|
|
|
|
|
|
|
// case 213/*AKEYCODE_MUHENKAN*/: return K_IME_;
|
|
|
|
|
|
|
|
// case 214/*AKEYCODE_HENKAN*/: return K_IME_;
|
|
|
|
|
|
|
|
// case 215/*AKEYCODE_KATAKANA_HIRAGANA*/: return K_IME_;
|
|
|
|
|
|
|
|
// case 216/*AKEYCODE_YEN*/: return K_;
|
|
|
|
|
|
|
|
// case 217/*AKEYCODE_RO*/: return K_;
|
|
|
|
|
|
|
|
// case 218/*AKEYCODE_KANA*/: return K_;
|
|
|
|
|
|
|
|
// case 219/*AKEYCODE_ASSIST*/: return K_MM_APP_ASSIST;
|
|
|
|
|
|
|
|
// case 220/*AKEYCODE_BRIGHTNESS_DOWN*/: return K_;
|
|
|
|
|
|
|
|
// case 221/*AKEYCODE_BRIGHTNESS_UP*/: return K_;
|
|
|
|
|
|
|
|
// case 222/*AKEYCODE_MEDIA_AUDIO_TRACK*/: return K_;
|
|
|
|
|
|
|
|
// case 223/*AKEYCODE_SLEEP*/: return K_;
|
|
|
|
|
|
|
|
// case 224/*AKEYCODE_WAKEUP*/: return K_;
|
|
|
|
|
|
|
|
// case 225/*AKEYCODE_PAIRING*/: return K_;
|
|
|
|
|
|
|
|
// case 226/*AKEYCODE_MEDIA_TOP_MENU*/: return K_;
|
|
|
|
|
|
|
|
// case 227/*AKEYCODE_11*/: return K_;
|
|
|
|
|
|
|
|
// case 228/*AKEYCODE_12*/: return K_;
|
|
|
|
|
|
|
|
// case 229/*AKEYCODE_LAST_CHANNEL*/: return K_;
|
|
|
|
|
|
|
|
// case 230/*AKEYCODE_TV_DATA_SERVICE*/: return K_;
|
|
|
|
|
|
|
|
// case 231/*AKEYCODE_VOICE_ASSIST*/: return K_MM_APP_VOICE;
|
|
|
|
|
|
|
|
// case 232/*AKEYCODE_TV_RADIO_SERVICE*/: return K_;
|
|
|
|
|
|
|
|
// case 233/*AKEYCODE_TV_TELETEXT*/: return K_;
|
|
|
|
|
|
|
|
// case 234/*AKEYCODE_TV_NUMBER_ENTRY*/: return K_;
|
|
|
|
|
|
|
|
// case 235/*AKEYCODE_TV_TERRESTRIAL_ANALOG*/: return K_;
|
|
|
|
|
|
|
|
// case 236/*AKEYCODE_TV_TERRESTRIAL_DIGITAL*/: return K_;
|
|
|
|
|
|
|
|
// case 237/*AKEYCODE_TV_SATELLITE*/: return K_;
|
|
|
|
|
|
|
|
// case 238/*AKEYCODE_TV_SATELLITE_BS*/: return K_;
|
|
|
|
|
|
|
|
// case 239/*AKEYCODE_TV_SATELLITE_CS*/: return K_;
|
|
|
|
|
|
|
|
// case 240/*AKEYCODE_TV_SATELLITE_SERVICE*/: return K_;
|
|
|
|
|
|
|
|
// case 241/*AKEYCODE_TV_NETWORK*/: return K_;
|
|
|
|
|
|
|
|
// case 242/*AKEYCODE_TV_ANTENNA_CABLE*/: return K_;
|
|
|
|
|
|
|
|
// case 243/*AKEYCODE_TV_INPUT_HDMI_1*/: return K_;
|
|
|
|
|
|
|
|
// case 244/*AKEYCODE_TV_INPUT_HDMI_2*/: return K_;
|
|
|
|
|
|
|
|
// case 245/*AKEYCODE_TV_INPUT_HDMI_3*/: return K_;
|
|
|
|
|
|
|
|
// case 246/*AKEYCODE_TV_INPUT_HDMI_4*/: return K_;
|
|
|
|
|
|
|
|
// case 247/*AKEYCODE_TV_INPUT_COMPOSITE_1*/: return K_;
|
|
|
|
|
|
|
|
// case 248/*AKEYCODE_TV_INPUT_COMPOSITE_2*/: return K_;
|
|
|
|
|
|
|
|
// case 249/*AKEYCODE_TV_INPUT_COMPONENT_1*/: return K_;
|
|
|
|
|
|
|
|
// case 250/*AKEYCODE_TV_INPUT_COMPONENT_2*/: return K_;
|
|
|
|
|
|
|
|
// case 251/*AKEYCODE_TV_INPUT_VGA_1*/: return K_;
|
|
|
|
|
|
|
|
// case 252/*AKEYCODE_TV_AUDIO_DESCRIPTION*/: return K_;
|
|
|
|
|
|
|
|
// case 253/*AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP*/: return K_;
|
|
|
|
|
|
|
|
// case 254/*AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN*/: return K_;
|
|
|
|
|
|
|
|
// case 255/*AKEYCODE_TV_ZOOM_MODE*/: return K_;
|
|
|
|
|
|
|
|
// case 256/*AKEYCODE_TV_CONTENTS_MENU*/: return K_;
|
|
|
|
|
|
|
|
// case 257/*AKEYCODE_TV_MEDIA_CONTEXT_MENU*/: return K_;
|
|
|
|
|
|
|
|
// case 258/*AKEYCODE_TV_TIMER_PROGRAMMING*/: return K_;
|
|
|
|
|
|
|
|
// case 259/*AKEYCODE_HELP*/: return K_;
|
|
|
|
|
|
|
|
// case 260/*AKEYCODE_NAVIGATE_PREVIOUS*/: return K_;
|
|
|
|
|
|
|
|
// case 261/*AKEYCODE_NAVIGATE_NEXT*/: return K_;
|
|
|
|
|
|
|
|
// case 262/*AKEYCODE_NAVIGATE_IN*/: return K_;
|
|
|
|
|
|
|
|
// case 263/*AKEYCODE_NAVIGATE_OUT*/: return K_;
|
|
|
|
|
|
|
|
// case 264/*AKEYCODE_STEM_PRIMARY*/: return K_;
|
|
|
|
|
|
|
|
// case 265/*AKEYCODE_STEM_1*/: return K_;
|
|
|
|
|
|
|
|
// case 266/*AKEYCODE_STEM_2*/: return K_;
|
|
|
|
|
|
|
|
// case 267/*AKEYCODE_STEM_3*/: return K_;
|
|
|
|
|
|
|
|
// case 268/*AKEYCODE_DPAD_UP_LEFT*/: return K_;
|
|
|
|
|
|
|
|
// case 269/*AKEYCODE_DPAD_DOWN_LEFT*/: return K_;
|
|
|
|
|
|
|
|
// case 270/*AKEYCODE_DPAD_UP_RIGHT*/: return K_;
|
|
|
|
|
|
|
|
// case 271/*AKEYCODE_DPAD_DOWN_RIGHT*/: return K_;
|
|
|
|
|
|
|
|
// case 272/*AKEYCODE_MEDIA_SKIP_FORWARD*/: return K_;
|
|
|
|
|
|
|
|
// case 273/*AKEYCODE_MEDIA_SKIP_BACKWARD*/: return K_;
|
|
|
|
|
|
|
|
// case 274/*AKEYCODE_MEDIA_STEP_FORWARD*/: return K_;
|
|
|
|
|
|
|
|
// case 275/*AKEYCODE_MEDIA_STEP_BACKWARD*/: return K_;
|
|
|
|
|
|
|
|
// case 276/*AKEYCODE_SOFT_SLEEP*/: return K_;
|
|
|
|
|
|
|
|
// case 277/*AKEYCODE_CUT*/: return K_;
|
|
|
|
|
|
|
|
// case 278/*AKEYCODE_COPY*/: return K_;
|
|
|
|
|
|
|
|
// case 279/*AKEYCODE_PASTE*/: return K_;
|
|
|
|
|
|
|
|
case 280/*KEYCODE_SYSTEM_NAVIGATION_UP*/: return K_UPARROW;
|
|
|
|
|
|
|
|
case 281/*KEYCODE_SYSTEM_NAVIGATION_DOWN*/: return K_DOWNARROW;
|
|
|
|
|
|
|
|
case 282/*KEYCODE_SYSTEM_NAVIGATION_LEFT*/: return K_LEFTARROW;
|
|
|
|
|
|
|
|
case 283/*KEYCODE_SYSTEM_NAVIGATION_RIGHT*/: return K_RIGHTARROW;
|
|
|
|
|
|
|
|
// case 284/*AKEYCODE_ALL_APPS */: return K_;
|
|
|
|
|
|
|
|
// case 285/*AKEYCODE_REFRESH */: return K_;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
Con_DPrintf("Android keycode %i is not supported\n", androidkey);
|
|
|
|
Con_DPrintf("Android keycode %i is not supported\n", androidkey);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -441,6 +567,8 @@ static void FTENativeActivity_keypress(JNIEnv *env, jobject this, jint devid, jb
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int qkeycode = mapkey(keycode);
|
|
|
|
int qkeycode = mapkey(keycode);
|
|
|
|
// Sys_Printf("FTENativeActivity_keypress: d=%i s=%i a=%i,q=%i u=%i\n", devid, down, keycode, qkeycode, unicode);
|
|
|
|
// Sys_Printf("FTENativeActivity_keypress: d=%i s=%i a=%i,q=%i u=%i\n", devid, down, keycode, qkeycode, unicode);
|
|
|
|
|
|
|
|
if (devid < 0)
|
|
|
|
|
|
|
|
devid = 0;
|
|
|
|
IN_KeyEvent(devid, down, qkeycode, unicode);
|
|
|
|
IN_KeyEvent(devid, down, qkeycode, unicode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static jboolean FTENativeActivity_wantrelative(JNIEnv *env, jobject this)
|
|
|
|
static jboolean FTENativeActivity_wantrelative(JNIEnv *env, jobject this)
|
|
|
@ -464,6 +592,8 @@ static void FTENativeActivity_mousepress(JNIEnv *env, jobject this, jint devid,
|
|
|
|
K_MOUSE2, //stylus_secondary
|
|
|
|
K_MOUSE2, //stylus_secondary
|
|
|
|
};
|
|
|
|
};
|
|
|
|
size_t i;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
if (devid < 0)
|
|
|
|
|
|
|
|
devid = 0;
|
|
|
|
heldbuttons = buttonbits;
|
|
|
|
heldbuttons = buttonbits;
|
|
|
|
if (changed)
|
|
|
|
if (changed)
|
|
|
|
for (i = 0; i < countof(qbutton); i++)
|
|
|
|
for (i = 0; i < countof(qbutton); i++)
|
|
|
@ -474,6 +604,8 @@ static void FTENativeActivity_mousepress(JNIEnv *env, jobject this, jint devid,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void FTENativeActivity_motion(JNIEnv *env, jobject this, jint ptrid, jint act, jfloat x, jfloat y, jfloat z, jfloat size)
|
|
|
|
static void FTENativeActivity_motion(JNIEnv *env, jobject this, jint ptrid, jint act, jfloat x, jfloat y, jfloat z, jfloat size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ptrid < 0)
|
|
|
|
|
|
|
|
ptrid = 0;
|
|
|
|
// Sys_Printf("FTENativeActivity_motion: d=%i a=%i x=%f y=%f z=%f s=%f\n", ptrid, act, x, y, z, size);
|
|
|
|
// Sys_Printf("FTENativeActivity_motion: d=%i a=%i x=%f y=%f z=%f s=%f\n", ptrid, act, x, y, z, size);
|
|
|
|
switch(act)
|
|
|
|
switch(act)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -489,6 +621,8 @@ static void FTENativeActivity_motion(JNIEnv *env, jobject this, jint ptrid, jint
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void FTENativeActivity_axis(JNIEnv *env, jobject this, jint devid, jint axis, jfloat value)
|
|
|
|
static void FTENativeActivity_axis(JNIEnv *env, jobject this, jint devid, jint axis, jfloat value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (devid < 0)
|
|
|
|
|
|
|
|
devid = 0;
|
|
|
|
IN_JoystickAxisEvent(devid, axis, value);
|
|
|
|
IN_JoystickAxisEvent(devid, axis, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//static void FTENativeActivity_accelerometer(JNIEnv *env, jobject obj, jint devid, jfloat x, jfloat y, jfloat z)
|
|
|
|
//static void FTENativeActivity_accelerometer(JNIEnv *env, jobject obj, jint devid, jfloat x, jfloat y, jfloat z)
|
|
|
@ -513,7 +647,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
|
|
|
JNIEnv *jni;
|
|
|
|
JNIEnv *jni;
|
|
|
|
if (JNI_OK == (*vm)->GetEnv(vm, (void**)&jni, JNI_VERSION_1_2))
|
|
|
|
if (JNI_OK == (*vm)->GetEnv(vm, (void**)&jni, JNI_VERSION_1_2))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
jclass naclass = (*jni)->FindClass(jni, "com.fteqw.FTENativeActivity");
|
|
|
|
jclass naclass = (*jni)->FindClass(jni, "com/fteqw/FTENativeActivity");
|
|
|
|
if (naclass)
|
|
|
|
if (naclass)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*jni)->RegisterNatives(jni, naclass, methods, countof(methods));
|
|
|
|
(*jni)->RegisterNatives(jni, naclass, methods, countof(methods));
|
|
|
|