--- /dev/null
+
+#include "../../include/SDL_scancode.h"
+
+static SDL_Scancode Tizen_Keycodes[] = {
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_ESCAPE,
+ SDL_SCANCODE_1,//10
+ SDL_SCANCODE_2,
+ SDL_SCANCODE_3,
+ SDL_SCANCODE_4,
+ SDL_SCANCODE_5,
+ SDL_SCANCODE_6,
+ SDL_SCANCODE_7,
+ SDL_SCANCODE_8,
+ SDL_SCANCODE_9,
+ SDL_SCANCODE_0,
+ SDL_SCANCODE_MINUS,
+ SDL_SCANCODE_EQUALS,
+ SDL_SCANCODE_BACKSPACE,
+ SDL_SCANCODE_TAB,
+ SDL_SCANCODE_Q,
+ SDL_SCANCODE_W,
+ SDL_SCANCODE_E,
+ SDL_SCANCODE_R,
+ SDL_SCANCODE_T,
+ SDL_SCANCODE_Y,
+ SDL_SCANCODE_U,
+ SDL_SCANCODE_I,
+ SDL_SCANCODE_O,
+ SDL_SCANCODE_P,
+ SDL_SCANCODE_LEFTBRACKET,
+ SDL_SCANCODE_RIGHTBRACKET,
+ SDL_SCANCODE_RETURN,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_A,
+ SDL_SCANCODE_S,
+ SDL_SCANCODE_D,
+ SDL_SCANCODE_F,
+ SDL_SCANCODE_G,
+ SDL_SCANCODE_H,
+ SDL_SCANCODE_J,
+ SDL_SCANCODE_K,
+ SDL_SCANCODE_L,
+ SDL_SCANCODE_SEMICOLON,
+ SDL_SCANCODE_APOSTROPHE,
+ SDL_SCANCODE_GRAVE,
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_NONUSBACKSLASH,
+ SDL_SCANCODE_Z,
+ SDL_SCANCODE_X,
+ SDL_SCANCODE_C,
+ SDL_SCANCODE_V,
+ SDL_SCANCODE_B,
+ SDL_SCANCODE_N,
+ SDL_SCANCODE_M,
+ SDL_SCANCODE_COMMA,
+ SDL_SCANCODE_PERIOD,
+ SDL_SCANCODE_SLASH,
+ SDL_SCANCODE_RSHIFT,
+ SDL_SCANCODE_KP_MULTIPLY,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_SPACE,
+ SDL_SCANCODE_CAPSLOCK,
+ SDL_SCANCODE_F1,
+ SDL_SCANCODE_F2,
+ SDL_SCANCODE_F3,
+ SDL_SCANCODE_F4,
+ SDL_SCANCODE_F5,
+ SDL_SCANCODE_F6,
+ SDL_SCANCODE_F7,
+ SDL_SCANCODE_F8,
+ SDL_SCANCODE_F9,
+ SDL_SCANCODE_F10,
+ SDL_SCANCODE_NUMLOCKCLEAR,
+ SDL_SCANCODE_SCROLLLOCK,
+ SDL_SCANCODE_KP_7,
+ SDL_SCANCODE_KP_8,
+ SDL_SCANCODE_KP_9,
+ SDL_SCANCODE_KP_MINUS,
+ SDL_SCANCODE_KP_4,
+ SDL_SCANCODE_KP_5,
+ SDL_SCANCODE_KP_6,
+ SDL_SCANCODE_KP_PLUS,
+ SDL_SCANCODE_KP_7,
+ SDL_SCANCODE_KP_8,
+ SDL_SCANCODE_KP_9,
+ SDL_SCANCODE_KP_0,
+ SDL_SCANCODE_KP_DECIMAL,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_KP_LESS,
+ SDL_SCANCODE_F11,
+ SDL_SCANCODE_F12,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_LANG3,
+ SDL_SCANCODE_LANG4,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_KP_ENTER,
+ SDL_SCANCODE_RCTRL,
+ SDL_SCANCODE_KP_DIVIDE,
+ SDL_SCANCODE_PRINTSCREEN,
+ SDL_SCANCODE_RALT,
+ SDL_SCANCODE_RETURN,
+ SDL_SCANCODE_HOME,
+ SDL_SCANCODE_UP,
+ SDL_SCANCODE_PRIOR,
+ SDL_SCANCODE_LEFT,
+ SDL_SCANCODE_RIGHT,
+ SDL_SCANCODE_END,
+ SDL_SCANCODE_DOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_INSERT,
+ SDL_SCANCODE_DELETE,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_AUDIOMUTE,
+ SDL_SCANCODE_VOLUMEDOWN,
+ SDL_SCANCODE_VOLUMEUP,
+ SDL_SCANCODE_POWER,
+ SDL_SCANCODE_KP_EQUALS,
+ SDL_SCANCODE_KP_PLUSMINUS,
+ SDL_SCANCODE_PAUSE,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_KP_DECIMAL,
+ SDL_SCANCODE_LANG1,
+ SDL_SCANCODE_LANG2,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_LGUI,
+ SDL_SCANCODE_RGUI,
+ SDL_SCANCODE_MENU,
+ SDL_SCANCODE_AUDIOSTOP,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNDO,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_COPY,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_PASTE,
+ SDL_SCANCODE_FIND,
+ SDL_SCANCODE_CUT,
+ SDL_SCANCODE_HELP,
+ SDL_SCANCODE_AC_HOME,
+ SDL_SCANCODE_CALCULATOR,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_SLEEP,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_WWW,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_MAIL,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_COMPUTER,
+ SDL_SCANCODE_AC_BACK,
+ SDL_SCANCODE_AC_FORWARD,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_EJECT,
+ SDL_SCANCODE_EJECT,
+ SDL_SCANCODE_AUDIONEXT,
+ SDL_SCANCODE_AUDIOPLAY,
+ SDL_SCANCODE_AUDIOPREV,
+ SDL_SCANCODE_AUDIOSTOP,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_MENU,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_KP_LEFTPAREN,
+ SDL_SCANCODE_KP_RIGHTPAREN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SC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DL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN,
+ SDL_SCANCODE_UNKNOWN//253
+};
+
#include "SDL_tizenwindow.h"
#include "SDL_log.h"
+#include "../../events/scancodes_tizen.h"
+#include "SDL_tizenkeyboard.h"
+
+static SDL_Scancode
+TranslateKeycode(int keycode)
+{
+ SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (keycode < SDL_arraysize(Tizen_Keycodes)) {
+ scancode = Tizen_Keycodes[keycode];
+ }
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Unknown keycode %d",keycode);
+ }
+ return scancode;
+}
+
void
Tizen_PumpEvents(_THIS)
{
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Key * e = event;
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key up: %d",e->keycode);
- SDL_SendKeyboardKey(SDL_RELEASED, e->keycode);
+ SDL_Scancode scancode = TranslateKeycode(e->keycode);
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key up: %d", scancode);
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
return ECORE_CALLBACK_PASS_ON;
}
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Key * e = event;
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key down: %d",e->keycode);
- SDL_SendKeyboardKey(SDL_PRESSED, e->keycode);
+ SDL_Scancode scancode = TranslateKeycode(e->keycode);
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key down: %d", scancode);
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
return ECORE_CALLBACK_PASS_ON;
}
return;
}
+void Tizen_SetKeymap()
+{
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ /* Add default scancode to key mapping */
+ SDL_GetDefaultKeymap(keymap);
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+}
+
void Tizen_InitKeyboard(_THIS)
{
//TODO : need the ref count
ecore_imf_context_focus_out(tizen_keyboard.imf_context);
ecore_imf_context_input_panel_hide(tizen_keyboard.imf_context);
+ Tizen_SetKeymap();
+
}
void Tizen_FiniKeyboard(void)