summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/sdl/button-sdl.c
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-02-08 20:05:25 +0000
committerThomas Jarosch <tomj@simonv.com>2011-02-08 20:05:25 +0000
commit5f037ac015e6d76d030a163753db5ff58cdff49b (patch)
treef5eb7dcdc0e0c3e373227e45061c1d99a14a0819 /firmware/target/hosted/sdl/button-sdl.c
parent4d129044390a087b6193b6ce63e035b2550b3ce4 (diff)
downloadrockbox-5f037ac015e6d76d030a163753db5ff58cdff49b.tar.gz
rockbox-5f037ac015e6d76d030a163753db5ff58cdff49b.zip
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
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 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
68static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ 68static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
69 69
70int sdl_app_has_input_focus = 1;
71
70#ifdef HAS_BUTTON_HOLD 72#ifdef HAS_BUTTON_HOLD
71bool hold_button_state = false; 73bool hold_button_state = false;
72bool button_hold(void) { 74bool button_hold(void) {
@@ -209,11 +211,34 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up)
209 211
210static bool event_handler(SDL_Event *event) 212static 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: