From b58d3656d79e5f9752a22d55c139294412084e4f Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 1 Jun 2011 14:41:49 +0000 Subject: FS#11925 - Add a proper system to keep track of the current screen/activity to make %cs far more useful git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29944 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index b027215ccc..5a99db2d8b 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -1021,3 +1021,20 @@ int clamp_value_wrap(int value, int max, int min) } #endif #endif +#define MAX_ACTIVITY_DEPTH 12 +static enum current_activity + current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN}; +static int current_activity_top = 0; +void push_current_activity(enum current_activity screen) +{ + current_activity[current_activity_top++] = screen; +} +void pop_current_activity(void) +{ + current_activity_top--; +} +enum current_activity get_current_activity(void) +{ + return current_activity[current_activity_top?current_activity_top-1:0]; +} + -- cgit v1.2.3