From a0e342b0f413679aa400f3f5b3db1e2b198fe5da Mon Sep 17 00:00:00 2001 From: unhelpful Date: Sun, 31 May 2009 17:47:56 +0000 Subject: [PATCH] Replace use of CONTEXT_CUSTOM by get_custom_action with new CONTEXT_PLUGIN, to prevent conflicts with core contexts using CONTEXT_CUSTOM, and use CONTEXT_TREE as the base context for PictureFlow's custom contexts. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21149 a1c6a512-1295-4272-9138-f99709370657 --- apps/action.c | 2 +- apps/action.h | 1 + apps/plugins/lib/pluginlib_actions.c | 12 ++++++------ apps/plugins/pictureflow/pictureflow.c | 13 ++++++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/action.c b/apps/action.c index 21198889d2..5810003744 100644 --- a/apps/action.c +++ b/apps/action.c @@ -197,7 +197,7 @@ static int get_action_worker(int context, int timeout, if (button & BUTTON_REMOTE) context |= CONTEXT_REMOTE; #endif - if ((context & CONTEXT_CUSTOM) && get_context_map) + if ((context & CONTEXT_PLUGIN) && get_context_map) items = get_context_map(context); else items = get_context_mapping(context); diff --git a/apps/action.h b/apps/action.h index 9869fb30b1..616fad57e9 100644 --- a/apps/action.h +++ b/apps/action.h @@ -30,6 +30,7 @@ #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ #define CONTEXT_CUSTOM2 0x20000000 /* as above */ +#define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */ #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c index 550cd56d48..e870c79b9c 100644 --- a/apps/plugins/lib/pluginlib_actions.c +++ b/apps/plugins/lib/pluginlib_actions.c @@ -71,7 +71,7 @@ const struct button_mapping remote_directions[] = #else #error pluginlib_actions: Unsupported remote keypad #endif - {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} + {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE} }; #endif /* HAVE_REMOTE_LCD */ @@ -174,7 +174,7 @@ const struct button_mapping generic_directions[] = #else #error pluginlib_actions: Unsupported keypad #endif - {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} + {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE} }; const struct button_mapping generic_left_right_fire[] = @@ -296,7 +296,7 @@ const struct button_mapping generic_left_right_fire[] = #else #error pluginlib_actions: Unsupported keypad #endif - {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} + {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE} }; /* these were taken from the bubbles plugin, so may need tweaking */ @@ -457,7 +457,7 @@ const struct button_mapping generic_actions[] = #else #error pluginlib_actions: Unsupported keypad #endif - {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} + {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE} }; const struct button_mapping generic_increase_decrease[] = @@ -537,7 +537,7 @@ const struct button_mapping generic_increase_decrease[] = #else #error pluginlib_actions: Unsupported keypad #endif - {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} + {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE} }; static struct button_mapping **plugin_context_order; @@ -560,5 +560,5 @@ int pluginlib_getaction(int timeout, plugin_context_order = (struct button_mapping **)plugin_contexts; plugin_context_count = count; last_context = 0; - return rb->get_custom_action(CONTEXT_CUSTOM,timeout,get_context_map); + return rb->get_custom_action(CONTEXT_PLUGIN,timeout,get_context_map); } diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index a7a4205fa2..de9859897c 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -70,6 +70,10 @@ const struct button_mapping pf_context_album_scroll[] = {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE}, {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE}, {PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE}, + {ACTION_NONE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT}, + {ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT}, + {ACTION_NONE, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT}, + {ACTION_NONE, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT}, #endif #if CONFIG_KEYPAD == ONDIO_PAD {PF_SELECT, BUTTON_UP|BUTTON_REL, BUTTON_UP}, @@ -77,9 +81,8 @@ const struct button_mapping pf_context_album_scroll[] = {ACTION_NONE, BUTTON_UP, BUTTON_NONE}, {ACTION_NONE, BUTTON_DOWN, BUTTON_NONE}, {ACTION_NONE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE}, - {ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT}, #endif - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1) + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN|1) }; #endif /* !defined(HAVE_SCROLLWHEEL) */ @@ -132,7 +135,7 @@ const struct button_mapping pf_context_buttons[] = #if CONFIG_KEYPAD == IAUDIO_M3_PAD LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE) #else - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_TREE) #endif }; const struct button_mapping *pf_contexts[] = @@ -681,7 +684,7 @@ const struct custom_format format_transposed = { static const struct button_mapping* get_context_map(int context) { - return pf_contexts[context & ~CONTEXT_CUSTOM]; + return pf_contexts[context & ~CONTEXT_PLUGIN]; } /* Create the lookup table with the scaling values for the reflections */ @@ -2596,7 +2599,7 @@ int main(void) rb->yield(); /*/ Handle buttons */ - button = rb->get_custom_action(CONTEXT_CUSTOM + button = rb->get_custom_action(CONTEXT_PLUGIN #if !defined(HAVE_SCROLLWHEEL) |(pf_state == pf_show_tracks ? 1 : 0) #endif -- 2.11.4.GIT