summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/sdl/button-sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/sdl/button-sdl.c')
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 3321a01..25dad09 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -67,6 +67,8 @@ struct event_queue button_queue;
static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
+int sdl_app_has_input_focus = 1;
+
#ifdef HAS_BUTTON_HOLD
bool hold_button_state = false;
bool button_hold(void) {
@@ -209,11 +211,34 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up)
static bool event_handler(SDL_Event *event)
{
+ SDLKey ev_key;
+
switch(event->type)
{
+ case SDL_ACTIVEEVENT:
+ if (event->active.state & SDL_APPINPUTFOCUS)
+ {
+ if (event->active.gain == 1)
+ sdl_app_has_input_focus = 1;
+ else
+ sdl_app_has_input_focus = 0;
+ }
+ break;
case SDL_KEYDOWN:
case SDL_KEYUP:
- button_event(event->key.keysym.sym, event->type == SDL_KEYDOWN);
+ ev_key = event->key.keysym.sym;
+#if (CONFIG_PLATFORM & PLATFORM_MAEMO5)
+ /* N900 with shared up/down cursor mapping. Seen on the German,
+ Finnish, Italian, French and Russian version. Probably more. */
+ if (event->key.keysym.mod & KMOD_MODE)
+ {
+ if (ev_key == SDLK_LEFT)
+ ev_key = SDLK_UP;
+ else if (ev_key == SDLK_RIGHT)
+ ev_key = SDLK_DOWN;
+ }
+#endif
+ button_event(ev_key, event->type == SDL_KEYDOWN);
break;
#ifdef HAVE_TOUCHSCREEN
case SDL_MOUSEMOTION: