diff options
Diffstat (limited to 'firmware/target/hosted/sdl/button-sdl.c')
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 27 |
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 3321a01bc6..25dad09341 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; | |||
67 | 67 | ||
68 | static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | 68 | static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ |
69 | 69 | ||
70 | int sdl_app_has_input_focus = 1; | ||
71 | |||
70 | #ifdef HAS_BUTTON_HOLD | 72 | #ifdef HAS_BUTTON_HOLD |
71 | bool hold_button_state = false; | 73 | bool hold_button_state = false; |
72 | bool button_hold(void) { | 74 | bool button_hold(void) { |
@@ -209,11 +211,34 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up) | |||
209 | 211 | ||
210 | static bool event_handler(SDL_Event *event) | 212 | static bool event_handler(SDL_Event *event) |
211 | { | 213 | { |
214 | SDLKey ev_key; | ||
215 | |||
212 | switch(event->type) | 216 | switch(event->type) |
213 | { | 217 | { |
218 | case SDL_ACTIVEEVENT: | ||
219 | if (event->active.state & SDL_APPINPUTFOCUS) | ||
220 | { | ||
221 | if (event->active.gain == 1) | ||
222 | sdl_app_has_input_focus = 1; | ||
223 | else | ||
224 | sdl_app_has_input_focus = 0; | ||
225 | } | ||
226 | break; | ||
214 | case SDL_KEYDOWN: | 227 | case SDL_KEYDOWN: |
215 | case SDL_KEYUP: | 228 | case SDL_KEYUP: |
216 | button_event(event->key.keysym.sym, event->type == SDL_KEYDOWN); | 229 | ev_key = event->key.keysym.sym; |
230 | #if (CONFIG_PLATFORM & PLATFORM_MAEMO5) | ||
231 | /* N900 with shared up/down cursor mapping. Seen on the German, | ||
232 | Finnish, Italian, French and Russian version. Probably more. */ | ||
233 | if (event->key.keysym.mod & KMOD_MODE) | ||
234 | { | ||
235 | if (ev_key == SDLK_LEFT) | ||
236 | ev_key = SDLK_UP; | ||
237 | else if (ev_key == SDLK_RIGHT) | ||
238 | ev_key = SDLK_DOWN; | ||
239 | } | ||
240 | #endif | ||
241 | button_event(ev_key, event->type == SDL_KEYDOWN); | ||
217 | break; | 242 | break; |
218 | #ifdef HAVE_TOUCHSCREEN | 243 | #ifdef HAVE_TOUCHSCREEN |
219 | case SDL_MOUSEMOTION: | 244 | case SDL_MOUSEMOTION: |