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 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'apps/tree.c') 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; } -- cgit v1.2.3