diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 30 |
1 files changed, 23 insertions, 7 deletions
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) | |||
739 | { | 739 | { |
740 | int button; | 740 | int button; |
741 | bool stop = false; | 741 | bool stop = false; |
742 | static bool ignore_power = true; | ||
742 | 743 | ||
743 | #ifdef HAVE_LCD_CHARCELLS | 744 | #ifdef HAVE_LCD_CHARCELLS |
744 | lcd_double_height(false); | 745 | lcd_double_height(false); |
@@ -767,22 +768,35 @@ static bool ask_resume(bool ask_once) | |||
767 | while (!stop) { | 768 | while (!stop) { |
768 | button = button_get(true); | 769 | button = button_get(true); |
769 | switch (button) { | 770 | switch (button) { |
771 | #ifdef TREE_RUN_PRE | ||
772 | case TREE_RUN_PRE: /* catch the press, not the release */ | ||
773 | #else | ||
770 | case TREE_RUN: | 774 | case TREE_RUN: |
775 | #endif | ||
771 | #ifdef TREE_RC_RUN | 776 | #ifdef TREE_RC_RUN |
772 | case TREE_RC_RUN: | 777 | case TREE_RC_RUN: |
773 | #endif | 778 | #endif |
779 | ignore_power = false; | ||
780 | /* Don't ignore the power button for subsequent calls */ | ||
774 | return true; | 781 | return true; |
775 | 782 | ||
776 | #ifdef BUTTON_ON | 783 | #ifdef TREE_POWER_BTN |
777 | /* ignore the ON button, since it might | 784 | /* Initially ignore the button which powers on the box. It |
778 | still be pressed since booting */ | 785 | might still be pressed since booting. */ |
779 | case BUTTON_ON: | 786 | case TREE_POWER_BTN: |
780 | case BUTTON_ON | BUTTON_REL: | 787 | case TREE_POWER_BTN | BUTTON_REPEAT: |
781 | case BUTTON_ON | BUTTON_REPEAT: | 788 | if(!ignore_power) |
789 | stop = true; | ||
790 | break; | ||
791 | |||
792 | /* No longer ignore the power button after it was released */ | ||
793 | case TREE_POWER_BTN | BUTTON_REL: | ||
794 | ignore_power = false; | ||
782 | break; | 795 | break; |
783 | #endif | 796 | #endif |
797 | /* Handle sys events, ignore button releases */ | ||
784 | default: | 798 | default: |
785 | if(default_event_handler(button) || (button & BUTTON_REL)) | 799 | if(default_event_handler(button) || !(button & BUTTON_REL)) |
786 | stop = true; | 800 | stop = true; |
787 | break; | 801 | break; |
788 | } | 802 | } |
@@ -793,6 +807,8 @@ static bool ask_resume(bool ask_once) | |||
793 | settings_save(); | 807 | settings_save(); |
794 | } | 808 | } |
795 | 809 | ||
810 | ignore_power = false; | ||
811 | /* Don't ignore the power button for subsequent calls */ | ||
796 | return false; | 812 | return false; |
797 | } | 813 | } |
798 | 814 | ||