From a398c2846aa86650aa386a68cb51929477b6aa23 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 21 Jun 2010 06:04:19 +0000 Subject: Touchregion support for the Base Skin and FM Skins. display obviously needs to be in stylus mode for this to work. Just about all screens should be mostly useable if your sbs has the next/prev/select/cancel/menu regions defined. Plenty of room to add new action abilities if they are wanted. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27004 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/statusbar-skinned.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'apps/gui/statusbar-skinned.c') diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c index fcd4cfbd9e..168b17fa38 100644 --- a/apps/gui/statusbar-skinned.c +++ b/apps/gui/statusbar-skinned.c @@ -21,6 +21,7 @@ #include "config.h" +#include "action.h" #include "system.h" #include "settings.h" #include "appevents.h" @@ -253,3 +254,36 @@ void sb_skin_init(void) sb_skin[i].sync_data = &sb_skin_sync_data; } } + +#ifdef HAVE_TOUCHSCREEN +static bool bypass_sb_touchregions = true; +void sb_bypass_touchregions(bool enable) +{ + bypass_sb_touchregions = enable; +} + +int sb_touch_to_button(int context) +{ + static int last_context = -1; + int button, offset; + if (bypass_sb_touchregions) + return ACTION_TOUCHSCREEN; + + if (last_context != context) + skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]); + last_context = context; + button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset); + + switch (button) + { +#ifdef HAVE_VOLUME_IN_LIST + case ACTION_WPS_VOLUP: + return ACTION_LIST_VOLUP; + case ACTION_WPS_VOLDOWN: + return ACTION_LIST_VOLDOWN; +#endif + /* TODO */ + } + return button; +} +#endif -- cgit