From 821e625e743edad8b65807f10cf97f43422bc8ec Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 24 Oct 2004 20:32:15 +0000 Subject: Fixes: (1) Selecting previous file/dir via remote in browser works again (typo). (2) The resume request should now always work as intended, properly ignoring button releases. The power button (ON for recorder/player, OFF for ondio) is now only ignored until the first release. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5337 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 30 +++++++++++++++++++++++------- apps/tree.h | 7 +++++-- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/tree.c b/apps/tree.c index 89864f5be5..745b4ebef6 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -739,6 +739,7 @@ static bool ask_resume(bool ask_once) { int button; bool stop = false; + static bool ignore_power = true; #ifdef HAVE_LCD_CHARCELLS lcd_double_height(false); @@ -767,22 +768,35 @@ static bool ask_resume(bool ask_once) while (!stop) { button = button_get(true); switch (button) { +#ifdef TREE_RUN_PRE + case TREE_RUN_PRE: /* catch the press, not the release */ +#else case TREE_RUN: +#endif #ifdef TREE_RC_RUN case TREE_RC_RUN: #endif + ignore_power = false; + /* Don't ignore the power button for subsequent calls */ return true; -#ifdef BUTTON_ON - /* ignore the ON button, since it might - still be pressed since booting */ - case BUTTON_ON: - case BUTTON_ON | BUTTON_REL: - case BUTTON_ON | BUTTON_REPEAT: +#ifdef TREE_POWER_BTN + /* Initially ignore the button which powers on the box. It + might still be pressed since booting. */ + case TREE_POWER_BTN: + case TREE_POWER_BTN | BUTTON_REPEAT: + if(!ignore_power) + stop = true; + break; + + /* No longer ignore the power button after it was released */ + case TREE_POWER_BTN | BUTTON_REL: + ignore_power = false; break; #endif + /* Handle sys events, ignore button releases */ default: - if(default_event_handler(button) || (button & BUTTON_REL)) + if(default_event_handler(button) || !(button & BUTTON_REL)) stop = true; break; } @@ -793,6 +807,8 @@ static bool ask_resume(bool ask_once) settings_save(); } + ignore_power = false; + /* Don't ignore the power button for subsequent calls */ return false; } diff --git a/apps/tree.h b/apps/tree.h index de5f2d0e01..880c26af4e 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -36,9 +36,10 @@ #define TREE_PGDN (BUTTON_ON | BUTTON_DOWN) #define TREE_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT) #define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY) +#define TREE_POWER_BTN BUTTON_ON #define TREE_RC_NEXT BUTTON_RC_RIGHT -#define TREE_RC_REV BUTTON_RC_LEFT +#define TREE_RC_PREV BUTTON_RC_LEFT #define TREE_RC_EXIT BUTTON_RC_STOP #define TREE_RC_ENTER BUTTON_RC_PLAY #define TREE_RC_RUN BUTTON_RC_PLAY @@ -54,9 +55,10 @@ #define TREE_WPS_PRE BUTTON_ON #define TREE_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT) #define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY) +#define TREE_POWER_BTN BUTTON_ON #define TREE_RC_NEXT BUTTON_RC_RIGHT -#define TREE_RC_REV BUTTON_RC_LEFT +#define TREE_RC_PREV BUTTON_RC_LEFT #define TREE_RC_EXIT BUTTON_RC_STOP #define TREE_RC_ENTER BUTTON_RC_PLAY #define TREE_RC_RUN BUTTON_RC_PLAY @@ -71,6 +73,7 @@ #define TREE_WPS (BUTTON_MENU | BUTTON_REL) #define TREE_WPS_PRE BUTTON_MENU #define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT) +#define TREE_POWER_BTN BUTTON_OFF #endif -- cgit v1.2.3