From f7675a244b0d1d52bfdf5a1ee0051b46e73f9f2e Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 22 Jul 2007 06:05:53 +0000 Subject: remove the need for action_signalscreenchange(). Fixes problems with targets where the ACTION_STD_CANCEL event is a combo git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13956 a1c6a512-1295-4272-9138-f99709370657 --- apps/action.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'apps/action.c') diff --git a/apps/action.c b/apps/action.c index d9f04a8c89..826f376dcd 100644 --- a/apps/action.c +++ b/apps/action.c @@ -29,8 +29,8 @@ #include "debug.h" #include "splash.h" -static bool ignore_until_release = false; -static int last_button = BUTTON_NONE; +static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to + work on startup */ static int last_action = ACTION_NONE; static bool repeated = false; @@ -104,6 +104,7 @@ static int get_action_worker(int context, int timeout, int button; int i=0; int ret = ACTION_UNKNOWN; + static int last_context = CONTEXT_STD; if (timeout == TIMEOUT_NOBLOCK) button = button_get(false); @@ -117,14 +118,18 @@ static int get_action_worker(int context, int timeout, return button; } - if (ignore_until_release == true) + if ((context != last_context) && ((last_button&BUTTON_REL) == 0)) { if (button&BUTTON_REL) { - ignore_until_release = false; + last_button = button; + last_action = ACTION_NONE; } + /* eat all buttons until the previous button was |BUTTON_REL + (also eat the |BUTTON_REL button) */ return ACTION_NONE; /* "safest" return value */ } + last_context = context; #ifndef HAS_BUTTON_HOLD screen_has_lock = ((context&ALLOW_SOFTLOCK)==ALLOW_SOFTLOCK); @@ -182,7 +187,6 @@ static int get_action_worker(int context, int timeout, { unlock_combo = button; keys_locked = true; - action_signalscreenchange(); gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON_PLAYER)); button_clear_queue(); @@ -214,22 +218,11 @@ int get_custom_action(int context,int timeout, bool action_userabort(int timeout) { - action_signalscreenchange(); int action = get_action_worker(CONTEXT_STD,timeout,NULL); bool ret = (action == ACTION_STD_CANCEL); - action_signalscreenchange(); return ret; } -void action_signalscreenchange(void) -{ - if ((last_button != BUTTON_NONE) && - !(last_button&BUTTON_REL)) - { - ignore_until_release = true; - } - last_button = BUTTON_NONE; -} #ifndef HAS_BUTTON_HOLD bool is_keys_locked(void) { @@ -247,7 +240,5 @@ int get_action_statuscode(int *button) ret |= ACTION_REMOTE; if (repeated) ret |= ACTION_REPEAT; - if (ignore_until_release) - ret |= ACTION_IGNORING; return ret; } -- cgit v1.2.3