From 5f037ac015e6d76d030a163753db5ff58cdff49b Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Tue, 8 Feb 2011 20:05:25 +0000 Subject: Initial maemo platform support Adds Nokia N900, N810 and N800 support. Features: - Introduce maemo specific platform defines - Play audio in silent mode - Stop playback on incoming calls - Battery level readout - Bluetooth headset support - Save CPU by disabling screen updates if the display is off or the app doesn't have input focus - N900: GStreamer audio backend Kudos to kugel for the code review. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29248 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/hosted/sdl/button-sdl.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'firmware/target/hosted/sdl/button-sdl.c') 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; 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: -- cgit v1.2.3