keybits_t keystate[SDLK_LAST / KEYBITS_WORD_BITS + 1];
};
+static void (*ext_event_handler)(void *event);
+
static const char * const in_sdl_keys[SDLK_LAST] = {
[SDLK_BACKSPACE] = "backspace",
[SDLK_TAB] = "tab",
[SDLK_8] = "8",
[SDLK_9] = "9",
[SDLK_COLON] = ":",
- [SDLK_SEMICOLON] = ",",
+ [SDLK_SEMICOLON] = ";",
[SDLK_LESS] = "<",
[SDLK_EQUALS] = "=",
[SDLK_GREATER] = ">",
[SDLK_DOWN] = "down",
[SDLK_RIGHT] = "right",
[SDLK_LEFT] = "left",
- [SDLK_DOWN] = "down",
[SDLK_INSERT] = "insert",
[SDLK_HOME] = "home",
[SDLK_END] = "end",
int *kc_out, int *down_out)
{
if (event->type != SDL_KEYDOWN && event->type != SDL_KEYUP)
- return 0;
+ return -1;
update_keystate(state->keystate, event->key.keysym.sym,
event->type == SDL_KEYDOWN);
down = event->jbutton.state == SDL_PRESSED;
ret = 1;
break;
+ default:
+ return -1;
}
if (ret)
else
ret = handle_event(state,
&events[i], one_kc, one_down);
+ if (ret == -1) {
+ if (ext_event_handler != NULL)
+ ext_event_handler(&events[i]);
+ continue;
+ }
+
retval |= ret;
if (one_kc != NULL && ret)
goto out;
/* XXX: maybe better set this from it's plat code somehow */
{ SDLK_RETURN, PBTN_MOK },
{ SDLK_ESCAPE, PBTN_MBACK },
- { SDLK_a, PBTN_MA2 },
- { SDLK_s, PBTN_MA3 },
+ { SDLK_SEMICOLON, PBTN_MA2 },
+ { SDLK_QUOTE, PBTN_MA3 },
{ SDLK_BACKSLASH, PBTN_MENU },
{ SDLK_LEFTBRACKET, PBTN_L },
{ SDLK_RIGHTBRACKET, PBTN_R },
.menu_translate = in_sdl_menu_translate,
};
-void in_sdl_init(const struct in_default_bind *defbinds)
+void in_sdl_init(const struct in_default_bind *defbinds,
+ void (*handler)(void *event))
{
in_register_driver(&in_sdl_drv, defbinds);
+ ext_event_handler = handler;
}
-