1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Andrew Mahone 2009-05-31 17:47:56 +00:00
parent c69331ef32
commit 29d7db4a46
4 changed files with 16 additions and 12 deletions

View file

@ -197,7 +197,7 @@ static int get_action_worker(int context, int timeout,
if (button & BUTTON_REMOTE) if (button & BUTTON_REMOTE)
context |= CONTEXT_REMOTE; context |= CONTEXT_REMOTE;
#endif #endif
if ((context & CONTEXT_CUSTOM) && get_context_map) if ((context & CONTEXT_PLUGIN) && get_context_map)
items = get_context_map(context); items = get_context_map(context);
else else
items = get_context_mapping(context); items = get_context_mapping(context);

View file

@ -30,6 +30,7 @@
#define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ #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_CUSTOM 0x40000000 /* | this against anything to get your context number */
#define CONTEXT_CUSTOM2 0x20000000 /* as above */ #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 { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE }
#define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }

View file

@ -71,7 +71,7 @@ const struct button_mapping remote_directions[] =
#else #else
#error pluginlib_actions: Unsupported remote keypad #error pluginlib_actions: Unsupported remote keypad
#endif #endif
{CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
}; };
#endif /* HAVE_REMOTE_LCD */ #endif /* HAVE_REMOTE_LCD */
@ -174,7 +174,7 @@ const struct button_mapping generic_directions[] =
#else #else
#error pluginlib_actions: Unsupported keypad #error pluginlib_actions: Unsupported keypad
#endif #endif
{CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
}; };
const struct button_mapping generic_left_right_fire[] = const struct button_mapping generic_left_right_fire[] =
@ -296,7 +296,7 @@ const struct button_mapping generic_left_right_fire[] =
#else #else
#error pluginlib_actions: Unsupported keypad #error pluginlib_actions: Unsupported keypad
#endif #endif
{CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
}; };
/* these were taken from the bubbles plugin, so may need tweaking */ /* these were taken from the bubbles plugin, so may need tweaking */
@ -457,7 +457,7 @@ const struct button_mapping generic_actions[] =
#else #else
#error pluginlib_actions: Unsupported keypad #error pluginlib_actions: Unsupported keypad
#endif #endif
{CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
}; };
const struct button_mapping generic_increase_decrease[] = const struct button_mapping generic_increase_decrease[] =
@ -537,7 +537,7 @@ const struct button_mapping generic_increase_decrease[] =
#else #else
#error pluginlib_actions: Unsupported keypad #error pluginlib_actions: Unsupported keypad
#endif #endif
{CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} {CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
}; };
static struct button_mapping **plugin_context_order; 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_order = (struct button_mapping **)plugin_contexts;
plugin_context_count = count; plugin_context_count = count;
last_context = 0; 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);
} }

View file

@ -70,6 +70,10 @@ const struct button_mapping pf_context_album_scroll[] =
{PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE}, {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{PF_NEXT, BUTTON_RIGHT, BUTTON_NONE}, {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE},
{PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, 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 #endif
#if CONFIG_KEYPAD == ONDIO_PAD #if CONFIG_KEYPAD == ONDIO_PAD
{PF_SELECT, BUTTON_UP|BUTTON_REL, BUTTON_UP}, {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_UP, BUTTON_NONE},
{ACTION_NONE, BUTTON_DOWN, BUTTON_NONE}, {ACTION_NONE, BUTTON_DOWN, BUTTON_NONE},
{ACTION_NONE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE}, {ACTION_NONE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
#endif #endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1) LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN|1)
}; };
#endif /* !defined(HAVE_SCROLLWHEEL) */ #endif /* !defined(HAVE_SCROLLWHEEL) */
@ -132,7 +135,7 @@ const struct button_mapping pf_context_buttons[] =
#if CONFIG_KEYPAD == IAUDIO_M3_PAD #if CONFIG_KEYPAD == IAUDIO_M3_PAD
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE) LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE)
#else #else
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_TREE)
#endif #endif
}; };
const struct button_mapping *pf_contexts[] = 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) 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 */ /* Create the lookup table with the scaling values for the reflections */
@ -2596,7 +2599,7 @@ int main(void)
rb->yield(); rb->yield();
/*/ Handle buttons */ /*/ Handle buttons */
button = rb->get_custom_action(CONTEXT_CUSTOM button = rb->get_custom_action(CONTEXT_PLUGIN
#if !defined(HAVE_SCROLLWHEEL) #if !defined(HAVE_SCROLLWHEEL)
|(pf_state == pf_show_tracks ? 1 : 0) |(pf_state == pf_show_tracks ? 1 : 0)
#endif #endif