2006-08-15 12:27:07 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2006-08-16 08:07:59 +00:00
|
|
|
* $Id$
|
2006-08-15 12:27:07 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Jonathan Gordon
|
2008-01-21 09:48:44 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-08-15 12:27:07 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
2006-08-17 13:31:34 +00:00
|
|
|
#include "lang.h"
|
|
|
|
|
2009-01-05 09:59:11 +00:00
|
|
|
#include "appevents.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
#include "button.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "debug.h"
|
2006-08-17 12:33:36 +00:00
|
|
|
#include "splash.h"
|
2008-01-21 09:48:44 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "pcmbuf.h"
|
2009-06-11 20:36:02 +00:00
|
|
|
#include "misc.h"
|
2009-10-05 17:17:30 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
|
|
|
|
#include "language.h"
|
|
|
|
#endif
|
2009-10-11 20:11:48 +00:00
|
|
|
#include "viewport.h"
|
2010-06-21 06:04:19 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
#include "statusbar-skinned.h"
|
|
|
|
#endif
|
2006-08-15 12:27:07 +00:00
|
|
|
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
#include "backlight.h"
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
#include "power.h"
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_BACKLIGHT */
|
|
|
|
|
|
|
|
#define LOGF_ENABLE
|
|
|
|
#include "logf.h"
|
|
|
|
|
2008-01-21 09:48:44 +00:00
|
|
|
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
|
2007-07-22 06:05:53 +00:00
|
|
|
work on startup */
|
2007-07-22 21:02:24 +00:00
|
|
|
static intptr_t last_data = 0;
|
2007-03-04 07:45:12 +00:00
|
|
|
static int last_action = ACTION_NONE;
|
|
|
|
static bool repeated = false;
|
2009-07-03 05:08:33 +00:00
|
|
|
static bool wait_for_release = false;
|
2006-08-17 12:33:36 +00:00
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2007-10-22 12:26:53 +00:00
|
|
|
static bool short_press = false;
|
|
|
|
#endif
|
|
|
|
|
2011-03-24 18:42:27 +00:00
|
|
|
#define REPEAT_WINDOW_TICKS HZ/4
|
2007-06-04 13:52:02 +00:00
|
|
|
static int last_action_tick = 0;
|
|
|
|
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
|
|
|
|
static inline bool is_action_normal(int action);
|
|
|
|
static inline bool mask_has_flag(unsigned int mask, unsigned int flag);
|
|
|
|
static inline bool is_action_completed(int button);
|
|
|
|
#define LAST_FILTER_TICKS HZ/2 /* timeout between filtered actions */
|
|
|
|
#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
|
|
|
|
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
static unsigned int backlight_mask = SEL_ACTION_NONE;
|
|
|
|
static int do_backlight(int action, int context, bool is_pre_btn);
|
|
|
|
static void handle_backlight(bool backlight, bool ignore_next);
|
|
|
|
#endif /* HAVE_BACKLIGHT */
|
|
|
|
|
2006-08-17 12:33:36 +00:00
|
|
|
/* software keylock stuff */
|
|
|
|
#ifndef HAS_BUTTON_HOLD
|
2006-12-12 07:55:17 +00:00
|
|
|
static bool keys_locked = false;
|
|
|
|
static bool screen_has_lock = false;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static unsigned int softlock_mask = SEL_ACTION_NONE;
|
|
|
|
static inline int do_softlock_unlock_combo(int button, int context);
|
|
|
|
static int do_softlock(int button, int action, int context, bool is_pre_btn);
|
2006-08-17 12:33:36 +00:00
|
|
|
#endif /* HAVE_SOFTWARE_KEYLOCK */
|
2006-08-15 12:27:07 +00:00
|
|
|
/*
|
|
|
|
* do_button_check is the worker function for get_default_action.
|
|
|
|
* returns ACTION_UNKNOWN or the requested return value from the list.
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
* BE AWARE is_pre_button can miss pre buttons if a match is found first.
|
2006-08-15 12:27:07 +00:00
|
|
|
*/
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static inline int do_button_check(const struct button_mapping *items,int button,
|
|
|
|
int last_button, int *start, bool *prebtn)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
int ret = ACTION_UNKNOWN;
|
|
|
|
|
|
|
|
while (items[i].button_code != BUTTON_NONE)
|
|
|
|
{
|
2008-01-21 09:48:44 +00:00
|
|
|
if (items[i].button_code == button)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization
- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
hosted targets. Most device specific code is in the
firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.
Code cleanup
- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
(see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.
Misc
- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.
Includes
- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/
Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.
Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/
The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.
Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.
Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-02-02 20:44:29 +00:00
|
|
|
/*
|
|
|
|
CAVEAT: This will allways return the action without pre_button_code if it has a
|
|
|
|
lower index in the list.
|
|
|
|
*/
|
2006-08-16 00:32:45 +00:00
|
|
|
if ((items[i].pre_button_code == BUTTON_NONE)
|
|
|
|
|| (items[i].pre_button_code == last_button))
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
|
|
|
ret = items[i].action_code;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else if (items[i].pre_button_code & button)
|
|
|
|
*prebtn = true; /* determine if this could be another action */
|
2006-08-15 12:27:07 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
*start = i;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-10-05 17:53:45 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
|
|
|
|
/*
|
|
|
|
* button is horizontally inverted to support RTL language if the given language
|
|
|
|
* and context combination require that
|
|
|
|
*/
|
|
|
|
static int button_flip_horizontally(int context, int button)
|
|
|
|
{
|
|
|
|
int newbutton;
|
|
|
|
|
|
|
|
if (!(lang_is_rtl() && ((context == CONTEXT_STD) ||
|
2009-10-08 22:19:36 +00:00
|
|
|
(context == CONTEXT_TREE) || (context == CONTEXT_LIST) ||
|
|
|
|
(context == CONTEXT_MAINMENU))))
|
2009-10-05 17:53:45 +00:00
|
|
|
{
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
|
|
|
newbutton = button &
|
|
|
|
~(BUTTON_LEFT | BUTTON_RIGHT
|
2009-10-06 18:01:05 +00:00
|
|
|
#if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD) && \
|
|
|
|
!defined(SIMULATOR)
|
2009-10-05 17:53:45 +00:00
|
|
|
| BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD
|
2009-12-05 15:54:05 +00:00
|
|
|
#endif
|
|
|
|
#if defined(BUTTON_MINUS) && defined(BUTTON_PLUS) && \
|
|
|
|
!defined(SIMULATOR)
|
|
|
|
| BUTTON_MINUS | BUTTON_PLUS
|
2009-10-05 17:53:45 +00:00
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
if (button & BUTTON_LEFT)
|
|
|
|
newbutton |= BUTTON_RIGHT;
|
|
|
|
if (button & BUTTON_RIGHT)
|
|
|
|
newbutton |= BUTTON_LEFT;
|
2009-10-06 18:01:05 +00:00
|
|
|
#if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD) && \
|
|
|
|
!defined(SIMULATOR)
|
2009-10-05 17:53:45 +00:00
|
|
|
if (button & BUTTON_SCROLL_BACK)
|
|
|
|
newbutton |= BUTTON_SCROLL_FWD;
|
|
|
|
if (button & BUTTON_SCROLL_FWD)
|
|
|
|
newbutton |= BUTTON_SCROLL_BACK;
|
|
|
|
#endif
|
2009-12-05 15:54:05 +00:00
|
|
|
#if defined(BUTTON_MINUS) && defined(BUTTON_PLUS) && \
|
|
|
|
!defined(SIMULATOR)
|
|
|
|
if (button & BUTTON_MINUS)
|
|
|
|
newbutton |= BUTTON_PLUS;
|
|
|
|
if (button & BUTTON_PLUS)
|
|
|
|
newbutton |= BUTTON_MINUS;
|
|
|
|
#endif
|
2009-10-05 17:53:45 +00:00
|
|
|
|
|
|
|
return newbutton;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-12-12 07:55:17 +00:00
|
|
|
static inline int get_next_context(const struct button_mapping *items, int i)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
|
|
|
while (items[i].button_code != BUTTON_NONE)
|
|
|
|
i++;
|
2008-01-21 09:48:44 +00:00
|
|
|
return (items[i].action_code == ACTION_NONE ) ?
|
|
|
|
CONTEXT_STD :
|
2006-08-15 12:27:07 +00:00
|
|
|
items[i].action_code;
|
|
|
|
}
|
2011-11-11 19:40:32 +00:00
|
|
|
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
/*
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
* int get_action_worker(int context, int timeout, bool *is_pre_button,
|
|
|
|
struct button_mapping *user_mappings)
|
2006-08-15 12:27:07 +00:00
|
|
|
This function searches the button list for the given context for the just
|
|
|
|
pressed button.
|
|
|
|
If there is a match it returns the value from the list.
|
|
|
|
If there is no match..
|
|
|
|
the last item in the list "points" to the next context in a chain
|
|
|
|
so the "chain" is followed until the button is found.
|
|
|
|
putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
BE AWARE is_pre_button can miss pre buttons if a match is found first.
|
|
|
|
it is more for actions that are not yet completed in the desired context
|
|
|
|
but are defined in a lower 'chained' context.
|
2006-08-15 12:27:07 +00:00
|
|
|
Timeout can be TIMEOUT_NOBLOCK to return immediatly
|
|
|
|
TIMEOUT_BLOCK to wait for a button press
|
2008-01-21 09:48:44 +00:00
|
|
|
Any number >0 to wait that many ticks for a press
|
2006-08-15 12:27:07 +00:00
|
|
|
*/
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static int get_action_worker(int context, int timeout, bool *is_pre_button,
|
2006-12-12 07:55:17 +00:00
|
|
|
const struct button_mapping* (*get_context_map)(int) )
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
2006-08-16 00:32:45 +00:00
|
|
|
const struct button_mapping *items = NULL;
|
2006-08-15 12:27:07 +00:00
|
|
|
int button;
|
|
|
|
int i=0;
|
|
|
|
int ret = ACTION_UNKNOWN;
|
2007-07-22 06:05:53 +00:00
|
|
|
static int last_context = CONTEXT_STD;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2009-01-05 09:59:11 +00:00
|
|
|
send_event(GUI_EVENT_ACTIONUPDATE, NULL);
|
2008-01-21 09:48:44 +00:00
|
|
|
|
2017-01-21 13:09:48 +00:00
|
|
|
button = button_get_w_tmo(timeout);
|
2011-11-11 19:40:32 +00:00
|
|
|
|
2010-10-31 15:32:57 +00:00
|
|
|
/* Data from sys events can be pulled with button_get_data
|
|
|
|
* multimedia button presses don't go through the action system */
|
|
|
|
if (button == BUTTON_NONE || button & (SYS_EVENT|BUTTON_MULTIMEDIA))
|
2012-07-18 08:25:32 +00:00
|
|
|
{
|
|
|
|
/* no button pressed so no point in waiting for release */
|
|
|
|
if (button == BUTTON_NONE)
|
|
|
|
wait_for_release = false;
|
2006-08-15 12:27:07 +00:00
|
|
|
return button;
|
2012-07-18 08:25:32 +00:00
|
|
|
}
|
|
|
|
|
2012-04-05 11:00:05 +00:00
|
|
|
/* the special redraw button should result in a screen refresh */
|
|
|
|
if (button == BUTTON_REDRAW)
|
|
|
|
return ACTION_REDRAW;
|
|
|
|
|
2012-07-18 08:25:32 +00:00
|
|
|
/* if action_wait_for_release() was called without a button being pressed
|
|
|
|
* then actually waiting for release would do the wrong thing, i.e.
|
|
|
|
* the next key press is entirely ignored. So, if here comes a normal
|
|
|
|
* button press (neither release nor repeat) the press is a fresh one and
|
|
|
|
* no point in waiting for release
|
|
|
|
*
|
|
|
|
* This logic doesn't work for touchscreen which can send normal
|
|
|
|
* button events repeatedly before the first repeat (as in BUTTON_REPEAT).
|
|
|
|
* These cannot be distinguished from the very first touch
|
|
|
|
* but there's nothing we can do about it here */
|
|
|
|
if ((button & (BUTTON_REPEAT|BUTTON_REL)) == 0)
|
|
|
|
wait_for_release = false;
|
|
|
|
|
2009-07-03 05:08:33 +00:00
|
|
|
/* Don't send any buttons through untill we see the release event */
|
|
|
|
if (wait_for_release)
|
|
|
|
{
|
|
|
|
if (button&BUTTON_REL)
|
|
|
|
{
|
2011-02-02 18:30:10 +00:00
|
|
|
/* remember the button for the below button eating on context
|
|
|
|
* change */
|
|
|
|
last_button = button;
|
2009-07-03 05:08:33 +00:00
|
|
|
wait_for_release = false;
|
|
|
|
}
|
|
|
|
return ACTION_NONE;
|
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2010-11-14 13:13:06 +00:00
|
|
|
if ((context != last_context) && ((last_button & BUTTON_REL) == 0)
|
|
|
|
#ifdef HAVE_SCROLLWHEEL
|
|
|
|
/* Scrollwheel doesn't generate release events */
|
|
|
|
&& !(last_button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD))
|
|
|
|
#endif
|
|
|
|
)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
2008-01-21 09:48:44 +00:00
|
|
|
if (button & BUTTON_REL)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
2007-07-22 06:05:53 +00:00
|
|
|
last_button = button;
|
|
|
|
last_action = ACTION_NONE;
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
2007-07-22 06:05:53 +00:00
|
|
|
/* eat all buttons until the previous button was |BUTTON_REL
|
|
|
|
(also eat the |BUTTON_REL button) */
|
2006-08-17 09:28:04 +00:00
|
|
|
return ACTION_NONE; /* "safest" return value */
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
2007-07-22 06:05:53 +00:00
|
|
|
last_context = context;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2006-08-17 12:33:36 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
2008-01-21 09:48:44 +00:00
|
|
|
screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
context &= ~ALLOW_SOFTLOCK;
|
2011-09-20 17:33:04 +00:00
|
|
|
if (is_keys_locked())
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
ret = do_softlock_unlock_combo(button, context);
|
|
|
|
if (!is_keys_locked())
|
|
|
|
return ret;
|
2006-08-17 12:33:36 +00:00
|
|
|
}
|
2013-09-02 09:03:56 +00:00
|
|
|
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
else if (!mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
|
2013-09-02 09:03:56 +00:00
|
|
|
{
|
|
|
|
/* make sure touchpad get reactivated if we quit the screen */
|
|
|
|
button_enable_touch(true);
|
|
|
|
}
|
|
|
|
#endif
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2006-08-17 12:33:36 +00:00
|
|
|
#endif /* HAS_BUTTON_HOLD */
|
2008-01-21 09:48:44 +00:00
|
|
|
|
2009-10-28 21:36:24 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
if (button & BUTTON_TOUCHSCREEN)
|
|
|
|
{
|
|
|
|
repeated = false;
|
|
|
|
short_press = false;
|
|
|
|
if (last_button & BUTTON_TOUCHSCREEN)
|
|
|
|
{
|
|
|
|
if ((button & BUTTON_REL) &&
|
|
|
|
((last_button & BUTTON_REPEAT)==0))
|
|
|
|
{
|
|
|
|
short_press = true;
|
|
|
|
}
|
|
|
|
else if (button & BUTTON_REPEAT)
|
|
|
|
repeated = true;
|
|
|
|
}
|
|
|
|
last_button = button;
|
|
|
|
return ACTION_TOUCHSCREEN;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-05 17:17:30 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
|
2009-10-05 17:53:45 +00:00
|
|
|
button = button_flip_horizontally(context, button);
|
2009-10-05 17:17:30 +00:00
|
|
|
#endif
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
/* logf("%x,%x",last_button,button); */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
*is_pre_button = false; /* could the button be another actions pre_button */
|
2009-02-03 10:55:30 +00:00
|
|
|
while (1)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
|
|
|
/* logf("context = %x",context); */
|
|
|
|
#if (BUTTON_REMOTE != 0)
|
2008-01-21 09:48:44 +00:00
|
|
|
if (button & BUTTON_REMOTE)
|
2006-08-15 12:27:07 +00:00
|
|
|
context |= CONTEXT_REMOTE;
|
|
|
|
#endif
|
2009-05-31 17:47:56 +00:00
|
|
|
if ((context & CONTEXT_PLUGIN) && get_context_map)
|
2006-08-15 12:27:07 +00:00
|
|
|
items = get_context_map(context);
|
|
|
|
else
|
|
|
|
items = get_context_mapping(context);
|
2008-01-21 09:48:44 +00:00
|
|
|
|
2009-02-03 10:55:30 +00:00
|
|
|
if (items == NULL)
|
2006-08-21 11:28:29 +00:00
|
|
|
break;
|
2008-01-21 09:48:44 +00:00
|
|
|
|
2017-01-17 22:50:38 +00:00
|
|
|
ret = do_button_check(items, button, last_button, &i, is_pre_button);
|
2009-02-03 10:55:30 +00:00
|
|
|
|
|
|
|
if (ret == ACTION_UNKNOWN)
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
|
|
|
context = get_next_context(items,i);
|
2009-02-03 10:55:30 +00:00
|
|
|
|
|
|
|
if (context != (int)CONTEXT_STOPSEARCHING)
|
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
2009-02-03 10:55:30 +00:00
|
|
|
/* Action was found or STOPSEARCHING was specified */
|
|
|
|
break;
|
|
|
|
}
|
2006-08-15 12:27:07 +00:00
|
|
|
/* DEBUGF("ret = %x\n",ret); */
|
2006-08-17 12:33:36 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if(screen_has_lock && is_action_normal(ret))
|
|
|
|
ret = do_softlock(button, ret, last_context & ~ALLOW_SOFTLOCK, is_pre_button);
|
2006-08-17 12:33:36 +00:00
|
|
|
#endif
|
2008-01-21 09:48:44 +00:00
|
|
|
if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
|
2007-06-04 13:52:02 +00:00
|
|
|
&& (ret == last_action))
|
2007-03-04 07:45:12 +00:00
|
|
|
repeated = true;
|
2008-01-21 09:48:44 +00:00
|
|
|
else
|
2007-03-04 07:45:12 +00:00
|
|
|
repeated = false;
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
last_button = button;
|
2007-03-11 12:32:29 +00:00
|
|
|
last_action = ret;
|
2007-07-22 21:02:24 +00:00
|
|
|
last_data = button_get_data();
|
2007-06-04 13:52:02 +00:00
|
|
|
last_action_tick = current_tick;
|
2012-01-12 11:28:36 +00:00
|
|
|
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
/* Produce keyclick */
|
2012-03-03 12:52:13 +00:00
|
|
|
keyclick_click(false, ret);
|
2012-01-12 11:28:36 +00:00
|
|
|
#endif
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
return ret;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
}/* get_action_worker */
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
int get_action(int context, int timeout)
|
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
bool is_pre_button = false;
|
|
|
|
int button = get_action_worker(context, timeout, &is_pre_button, NULL);
|
|
|
|
|
2010-06-21 06:04:19 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
if (button == ACTION_TOUCHSCREEN)
|
|
|
|
button = sb_touch_to_button(context);
|
|
|
|
#endif
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
if (mask_has_flag(backlight_mask, SEL_ACTION_ENABLED) &&
|
|
|
|
is_action_normal(button))
|
|
|
|
button = do_backlight(button, context & ~ALLOW_SOFTLOCK, is_pre_button);
|
|
|
|
#endif
|
|
|
|
|
2010-06-21 06:04:19 +00:00
|
|
|
return button;
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int get_custom_action(int context,int timeout,
|
2006-08-16 00:32:45 +00:00
|
|
|
const struct button_mapping* (*get_context_map)(int))
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
bool is_pre_button = false;
|
|
|
|
return get_action_worker(context,timeout, &is_pre_button, get_context_map);
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool action_userabort(int timeout)
|
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
bool is_pre_button = false;
|
|
|
|
int action = get_action_worker(CONTEXT_STD,timeout, &is_pre_button, NULL);
|
2006-08-15 12:27:07 +00:00
|
|
|
bool ret = (action == ACTION_STD_CANCEL);
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if (!ret)
|
2009-06-11 20:36:02 +00:00
|
|
|
{
|
|
|
|
default_event_handler(action);
|
|
|
|
}
|
2006-08-15 12:27:07 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-07-22 21:02:24 +00:00
|
|
|
intptr_t get_action_data(void)
|
|
|
|
{
|
|
|
|
return last_data;
|
|
|
|
}
|
|
|
|
|
2007-03-04 07:45:12 +00:00
|
|
|
int get_action_statuscode(int *button)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
if (button)
|
|
|
|
*button = last_button;
|
|
|
|
|
2008-01-21 09:48:44 +00:00
|
|
|
if (last_button & BUTTON_REMOTE)
|
2007-03-04 07:45:12 +00:00
|
|
|
ret |= ACTION_REMOTE;
|
|
|
|
if (repeated)
|
|
|
|
ret |= ACTION_REPEAT;
|
|
|
|
return ret;
|
|
|
|
}
|
2007-10-22 12:26:53 +00:00
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-06-02 16:08:01 +00:00
|
|
|
/* return BUTTON_NONE on error
|
|
|
|
* BUTTON_REPEAT if repeated press
|
|
|
|
* BUTTON_REPEAT|BUTTON_REL if release after repeated press
|
2010-04-19 19:49:42 +00:00
|
|
|
* BUTTON_REL if it's a short press = release after press
|
2008-08-23 09:46:38 +00:00
|
|
|
* BUTTON_TOUCHSCREEN if press
|
2008-06-02 16:08:01 +00:00
|
|
|
*/
|
2008-08-23 09:46:38 +00:00
|
|
|
int action_get_touchscreen_press(short *x, short *y)
|
2007-10-22 12:26:53 +00:00
|
|
|
{
|
|
|
|
static int last_data = 0;
|
|
|
|
int data;
|
2008-08-23 09:46:38 +00:00
|
|
|
if ((last_button & BUTTON_TOUCHSCREEN) == 0)
|
2007-10-22 12:26:53 +00:00
|
|
|
return BUTTON_NONE;
|
|
|
|
data = button_get_data();
|
2008-01-21 09:48:44 +00:00
|
|
|
if (last_button & BUTTON_REL)
|
2007-10-22 12:26:53 +00:00
|
|
|
{
|
|
|
|
*x = (last_data&0xffff0000)>>16;
|
|
|
|
*y = (last_data&0xffff);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*x = (data&0xffff0000)>>16;
|
|
|
|
*y = (data&0xffff);
|
|
|
|
}
|
|
|
|
last_data = data;
|
|
|
|
if (repeated)
|
|
|
|
return BUTTON_REPEAT;
|
|
|
|
if (short_press)
|
|
|
|
return BUTTON_REL;
|
2008-06-02 16:08:01 +00:00
|
|
|
/* This is to return a BUTTON_REL after a BUTTON_REPEAT. */
|
2008-05-30 22:55:24 +00:00
|
|
|
if (last_button & BUTTON_REL)
|
2008-06-01 13:56:34 +00:00
|
|
|
return BUTTON_REPEAT|BUTTON_REL;
|
2008-08-23 09:46:38 +00:00
|
|
|
return BUTTON_TOUCHSCREEN;
|
2007-10-22 12:26:53 +00:00
|
|
|
}
|
2009-10-11 20:11:48 +00:00
|
|
|
|
|
|
|
int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp)
|
|
|
|
{
|
|
|
|
short x, y;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = action_get_touchscreen_press(&x, &y);
|
|
|
|
|
|
|
|
if (ret != BUTTON_NONE && viewport_point_within_vp(vp, x, y))
|
|
|
|
{
|
|
|
|
*x1 = x - vp->x;
|
|
|
|
*y1 = y - vp->y;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (ret & BUTTON_TOUCHSCREEN)
|
|
|
|
return ACTION_UNKNOWN;
|
|
|
|
return BUTTON_NONE;
|
|
|
|
}
|
2007-10-22 12:26:53 +00:00
|
|
|
#endif
|
2009-07-03 05:08:33 +00:00
|
|
|
|
2010-05-04 21:02:32 +00:00
|
|
|
/* Don't let get_action*() return any ACTION_* values until the current buttons
|
|
|
|
* have been released. SYS_* and BUTTON_NONE will go through.
|
|
|
|
* Any actions relying on _RELEASE won't get seen.
|
2012-07-18 08:25:32 +00:00
|
|
|
*
|
|
|
|
* Note this doesn't currently work for touchscreen targets if called
|
|
|
|
* when the screen isn't currently touched, because they can send normal
|
|
|
|
* (non-BUTTON_REPEAT) events repeatedly, if the touch coordinates change.
|
|
|
|
* This cannot be distinguished from normal buttons events.
|
2009-07-03 05:08:33 +00:00
|
|
|
*/
|
|
|
|
void action_wait_for_release(void)
|
|
|
|
{
|
|
|
|
wait_for_release = true;
|
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
|
|
|
|
/* HELPER FUNCTIONS
|
|
|
|
* Selective softlock and backlight use this lookup based on mask to decide
|
|
|
|
* which actions are filtered, or could be filtered but not currently set.
|
|
|
|
* returns false if the action isn't found, true if the action is found
|
|
|
|
*/
|
|
|
|
static bool is_action_filtered(int action, unsigned int mask, int context)
|
|
|
|
{
|
|
|
|
bool match = false;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_NONE:
|
|
|
|
break;
|
|
|
|
/*Actions that are not mapped will not turn on the backlight option NOUNMAPPED*/
|
|
|
|
case ACTION_UNKNOWN:
|
|
|
|
match = mask_has_flag(mask, SEL_ACTION_NOUNMAPPED);
|
|
|
|
break;
|
|
|
|
case ACTION_WPS_PLAY:
|
|
|
|
case ACTION_FM_PLAY:
|
|
|
|
match = mask_has_flag(mask, SEL_ACTION_PLAY);
|
|
|
|
break;
|
|
|
|
case ACTION_STD_PREVREPEAT:
|
|
|
|
case ACTION_STD_NEXTREPEAT:
|
|
|
|
case ACTION_WPS_SEEKBACK:
|
|
|
|
case ACTION_WPS_SEEKFWD:
|
|
|
|
case ACTION_WPS_STOPSEEK:
|
|
|
|
match = mask_has_flag(mask, SEL_ACTION_SEEK);
|
|
|
|
break;
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
case ACTION_WPS_SKIPNEXT:
|
|
|
|
case ACTION_WPS_SKIPPREV:
|
|
|
|
case ACTION_FM_NEXT_PRESET:
|
|
|
|
case ACTION_FM_PREV_PRESET:
|
|
|
|
match = mask_has_flag(mask, SEL_ACTION_SKIP);
|
|
|
|
break;
|
|
|
|
case ACTION_WPS_VOLUP:
|
|
|
|
case ACTION_WPS_VOLDOWN:
|
|
|
|
match = mask_has_flag(mask, SEL_ACTION_VOL);
|
|
|
|
break;
|
|
|
|
case ACTION_SETTINGS_INC:/*FMS*/
|
|
|
|
case ACTION_SETTINGS_INCREPEAT:/*FMS*/
|
|
|
|
case ACTION_SETTINGS_DEC:/*FMS*/
|
|
|
|
case ACTION_SETTINGS_DECREPEAT:/*FMS*/
|
|
|
|
match = (context == CONTEXT_FM) && mask_has_flag(mask, SEL_ACTION_VOL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* display action code of unfiltered actions */
|
|
|
|
logf ("unfiltered actions: context: %d action: %d, last btn: %d, \
|
|
|
|
mask: %d", context, action, last_button, mask);
|
|
|
|
break;
|
|
|
|
}/*switch*/
|
|
|
|
|
|
|
|
return match;
|
|
|
|
}
|
|
|
|
/* compares mask to a flag return true if set false otherwise*/
|
|
|
|
static inline bool mask_has_flag(unsigned int mask, unsigned int flag)
|
|
|
|
{
|
|
|
|
return ((mask & flag) != 0);
|
|
|
|
}
|
|
|
|
/* returns true if the supplied context is to be filtered by selective BL/SL*/
|
|
|
|
static inline bool is_context_filtered(int context)
|
|
|
|
{
|
|
|
|
return (context == CONTEXT_FM || context == CONTEXT_WPS);
|
|
|
|
}
|
|
|
|
/* returns true if action can be passed on to selective backlight/softlock */
|
|
|
|
static inline bool is_action_normal(int action)
|
|
|
|
{
|
|
|
|
return (action != ACTION_REDRAW && (action & SYS_EVENT) == 0);
|
|
|
|
}
|
|
|
|
/*returns true if Button & released, repeated; or won't generate those events*/
|
|
|
|
static inline bool is_action_completed(int button)
|
|
|
|
{
|
|
|
|
return ((button & (BUTTON_REPEAT | BUTTON_REL)) != 0
|
|
|
|
#ifdef HAVE_SCROLLWHEEL
|
|
|
|
/* Scrollwheel doesn't generate release events */
|
|
|
|
|| (button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD)) != 0
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* most every action takes two rounds through get_action_worker,
|
|
|
|
* once for the keypress and once for the key release,
|
|
|
|
* actions with pre_button codes take even more, some actions however, only
|
|
|
|
* take once; actions defined with only a button and no release/repeat event,
|
|
|
|
* these actions should be acted upon immediately except when we have
|
|
|
|
* selective backlighting/softlock enabled and in this case we only act upon
|
|
|
|
* them immediately if there is no chance they have another event tied to them
|
|
|
|
* determined using is_pre_button and is_action_completed()
|
|
|
|
*returns true if event was not filtered and false if it was
|
|
|
|
*/
|
|
|
|
static bool is_action_unfiltered(int action,int button, bool is_pre_button,
|
|
|
|
bool filtered, int *tick)
|
|
|
|
{
|
|
|
|
bool ret = false;
|
|
|
|
/*directly after a match a key release event may trigger another*/
|
|
|
|
if (filtered && action != ACTION_UNKNOWN)
|
|
|
|
*tick = current_tick + LAST_FILTER_TICKS;
|
|
|
|
/* has button been rel/rep or is this the only action it could be */
|
|
|
|
if (is_action_completed(button) || !is_pre_button)
|
|
|
|
{
|
|
|
|
/* reset last action , if the action is not filtered and
|
|
|
|
this isn't just a key release event then return true */
|
|
|
|
if (!filtered && *tick < current_tick)
|
|
|
|
{
|
|
|
|
*tick = 0;
|
|
|
|
ret = true;
|
|
|
|
}
|
|
|
|
}/*is_action_completed() || !is_pre_button*/
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif /*defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) HELPER FUNCTIONS*/
|
|
|
|
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
static void handle_backlight(bool backlight, bool ignore_next)
|
|
|
|
{
|
|
|
|
if (backlight)
|
|
|
|
{
|
|
|
|
backlight_on_ignore(false, 0);
|
|
|
|
backlight_on();
|
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
|
|
|
buttonlight_on_ignore(false, 0);
|
|
|
|
buttonlight_on();
|
|
|
|
}
|
|
|
|
buttonlight_on_ignore(ignore_next, 5*HZ);/* as a precautionary fallback */
|
|
|
|
#else
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
backlight_on_ignore(ignore_next, 5*HZ);/*must be set everytime we handle bl*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Need to look up actions before we can decide to turn on backlight, if
|
|
|
|
* selective backlighting is true filter first keypress events need to be
|
|
|
|
* taken into account as well
|
|
|
|
*/
|
|
|
|
static int do_backlight(int action, int context, bool is_pre_btn)
|
|
|
|
{
|
|
|
|
static int last_filtered_tick = 0;
|
|
|
|
|
|
|
|
bool bl_is_active = is_backlight_on(false);
|
|
|
|
bool bl_activate = false;
|
|
|
|
bool filtered;
|
|
|
|
|
|
|
|
#if CONFIG_CHARGING /* disable if on external power */
|
|
|
|
if (!bl_is_active && is_context_filtered(context) &&
|
|
|
|
!(mask_has_flag(backlight_mask, SEL_ACTION_NOEXT) && power_input_present()))
|
|
|
|
#else /* skip if backlight is on or incorrect context */
|
|
|
|
if (!bl_is_active && is_context_filtered(context))
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
filtered = is_action_filtered(action, backlight_mask, context);
|
|
|
|
bl_activate = is_action_unfiltered(action, last_button, is_pre_btn,
|
|
|
|
filtered, &last_filtered_tick);
|
|
|
|
}/*is_context_filtered(context)*/
|
|
|
|
else
|
|
|
|
bl_activate = true;
|
|
|
|
|
|
|
|
if (action != ACTION_NONE && bl_activate)
|
|
|
|
{
|
|
|
|
handle_backlight(true, true);
|
|
|
|
|
|
|
|
if (mask_has_flag(backlight_mask, SEL_ACTION_FFKEYPRESS) && !bl_is_active)
|
|
|
|
{
|
|
|
|
action = ACTION_NONE;
|
|
|
|
last_button = BUTTON_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
handle_backlight(false, true);/* set ignore next true */
|
|
|
|
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable selected actions to leave the backlight off */
|
|
|
|
void set_selective_backlight_actions(bool selective, unsigned int mask,
|
|
|
|
bool filter_fkp)
|
|
|
|
{
|
|
|
|
handle_backlight(true, selective);
|
|
|
|
if (selective) /* we will handle filter_first_keypress here so turn it off*/
|
|
|
|
{
|
|
|
|
set_backlight_filter_keypress(false);/* turnoff ffkp in button.c */
|
|
|
|
backlight_mask = mask | SEL_ACTION_ENABLED;
|
|
|
|
if(filter_fkp)
|
|
|
|
backlight_mask |= SEL_ACTION_FFKEYPRESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_backlight_filter_keypress(filter_fkp);
|
|
|
|
backlight_mask = SEL_ACTION_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_BACKLIGHT */
|
|
|
|
|
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
bool is_keys_locked(void)
|
|
|
|
{
|
|
|
|
return (screen_has_lock && keys_locked);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void do_key_lock(bool lock)
|
|
|
|
{
|
|
|
|
keys_locked = lock;
|
|
|
|
last_button = BUTTON_NONE;
|
|
|
|
button_clear_queue();
|
|
|
|
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
|
|
|
|
/* disable touch device on keylock if std behavior or selected disable touch */
|
|
|
|
if (!mask_has_flag(softlock_mask, SEL_ACTION_ENABLED) ||
|
|
|
|
mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
|
|
|
|
button_enable_touch(!lock);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* user selected autolock based on backlight timeout; toggles autolock on / off
|
|
|
|
by ACTION_STD_KEYLOCK presses, Activates autolock if set on backlight timeout
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
static inline int do_auto_softlock(int button, int action, int *unlock_combo)
|
|
|
|
{
|
|
|
|
if(mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK) && !is_backlight_on(false))
|
|
|
|
do_key_lock(true);
|
|
|
|
|
|
|
|
else if (action == ACTION_STD_KEYLOCK)
|
|
|
|
{
|
|
|
|
*unlock_combo = button;/* set unlock combo to allow unlock */
|
|
|
|
softlock_mask ^= SEL_ACTION_ALOCK_OK;
|
|
|
|
handle_backlight(true, false);
|
|
|
|
/* If we don't wait for a moment for the backlight queue
|
|
|
|
* to process, the user will never see the message */
|
|
|
|
if (!is_backlight_on(false))
|
|
|
|
sleep(HZ/2);
|
|
|
|
|
|
|
|
if (mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK))
|
|
|
|
{
|
|
|
|
splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON));
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF));
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Allows unlock softlock when action is not yet known but unlock_combo set*/
|
|
|
|
static inline int do_softlock_unlock_combo(int button, int context)
|
|
|
|
{
|
|
|
|
return do_softlock(button, ACTION_NONE, context, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handles softlock once action is known */
|
|
|
|
static int do_softlock(int button, int action, int context, bool is_pre_btn)
|
|
|
|
{
|
|
|
|
static int last_filtered_tick = 0;
|
|
|
|
static int unlock_combo = BUTTON_NONE; /*Moved from GLOBAL*/
|
|
|
|
bool filtered = true;
|
|
|
|
bool notify_user = false;
|
|
|
|
bool sl_activate = true; /* standard softlock behavior */
|
|
|
|
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
if (!keys_locked && mask_has_flag(softlock_mask, SEL_ACTION_AUTOLOCK))
|
|
|
|
action = do_auto_softlock(button, action, &unlock_combo);
|
|
|
|
#endif
|
|
|
|
/* Lock/Unlock toggled by ACTION_STD_KEYLOCK presses*/
|
|
|
|
if ((action == ACTION_STD_KEYLOCK) || (keys_locked && unlock_combo == button))
|
|
|
|
{
|
|
|
|
unlock_combo = button;
|
|
|
|
do_key_lock(!keys_locked);
|
|
|
|
notify_user = true;
|
|
|
|
}
|
|
|
|
#if (BUTTON_REMOTE != 0)/* Allow remote actions through */
|
|
|
|
else if (mask_has_flag(button, BUTTON_REMOTE))
|
|
|
|
notify_user = false;
|
|
|
|
#endif
|
|
|
|
else if (keys_locked && action != ACTION_NONE && action != ACTION_REDRAW)
|
|
|
|
{
|
|
|
|
if (mask_has_flag(softlock_mask, SEL_ACTION_ENABLED))
|
|
|
|
{
|
|
|
|
filtered = is_action_filtered(action, softlock_mask, context);
|
|
|
|
|
|
|
|
sl_activate = is_action_unfiltered(action, button, is_pre_btn,
|
|
|
|
filtered, &last_filtered_tick);
|
|
|
|
}
|
|
|
|
/*All non-std softlock options are set to 0 if advanced sl is disabled*/
|
|
|
|
if (sl_activate)
|
|
|
|
{
|
|
|
|
if (!mask_has_flag(softlock_mask, SEL_ACTION_NONOTIFY))
|
|
|
|
{ /* always true on standard softlock behavior*/
|
|
|
|
notify_user = mask_has_flag(button, BUTTON_REL);
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
action = ACTION_NONE;
|
|
|
|
}
|
|
|
|
else if (!filtered)/*catch blocked actions on fast repeated presses*/
|
|
|
|
action = ACTION_NONE;
|
|
|
|
} /* keys_locked */
|
|
|
|
|
|
|
|
#ifdef BUTTON_POWER /*always notify if power button pressed while keys locked*/
|
|
|
|
notify_user |= (mask_has_flag(button, BUTTON_POWER) && keys_locked);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (notify_user)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
handle_backlight(true, false);
|
|
|
|
/* If we don't wait for a moment for the backlight queue
|
|
|
|
* to process, the user will never see the message */
|
|
|
|
if (!is_backlight_on(false))
|
|
|
|
sleep(HZ/2);
|
|
|
|
#endif
|
|
|
|
if (keys_locked)
|
|
|
|
splash(HZ/2, ID2P(LANG_KEYLOCK_ON));
|
|
|
|
else
|
|
|
|
splash(HZ/2, ID2P(LANG_KEYLOCK_OFF));
|
|
|
|
|
|
|
|
last_button = BUTTON_NONE;
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
button_clear_queue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_selective_softlock_actions(bool selective, unsigned int mask)
|
|
|
|
{
|
|
|
|
keys_locked = false;
|
|
|
|
if(selective)
|
|
|
|
softlock_mask = mask | SEL_ACTION_ENABLED;
|
|
|
|
else
|
|
|
|
softlock_mask = SEL_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAS_BUTTON_HOLD */
|