summaryrefslogtreecommitdiff
path: root/apps/action.h
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2016-11-22 06:21:31 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2017-01-17 23:06:17 +0100
commitdc87e9e9f3c383b63c3cb3713886a6c93b6a79d1 (patch)
tree47a6c0d49e7741f91fa74d7230b1267f60617902 /apps/action.h
parent16a9f84571276a13f4cfd5c66db8cd63ce4e2e7f (diff)
downloadrockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.tar.gz
rockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.zip
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
Diffstat (limited to 'apps/action.h')
-rw-r--r--apps/action.h102
1 files changed, 64 insertions, 38 deletions
diff --git a/apps/action.h b/apps/action.h
index e54d5deacf..3bc43c2190 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -41,37 +41,66 @@
41#else 41#else
42#define ALLOW_SOFTLOCK 0 42#define ALLOW_SOFTLOCK 0
43#endif 43#endif
44#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
45/* Selective action selection flags */
46#define SEL_ACTION_NONE 0
47#define SEL_ACTION_VOL 0x001U
48#define SEL_ACTION_PLAY 0x002U
49#define SEL_ACTION_SEEK 0x004U
50#define SEL_ACTION_SKIP 0x008U
51#define SEL_ACTION_NOUNMAPPED 0x010U/* disable backlight on unmapped buttons */
52 /* Available 0x020U*/
53 /* Available 0x040U*/
54#define SEL_ACTION_NOTOUCH 0x080U/* disable touch screen/pad on screen lock */
55#define SEL_ACTION_AUTOLOCK 0x100U/* autolock on backlight off */
56#define SEL_ACTION_NOEXT 0x200U/* disable selective backlight while charge*/
57#define SEL_ACTION_NONOTIFY 0x200U/* don't notify user softlock is active */
58/* Flags below are internal to selective functions */
59#define SEL_ACTION_ALOCK_OK 0x400U/*autolock only active after key lock once*/
60#define SEL_ACTION_FFKEYPRESS 0x400U/* backlight Filter First Keypress active*/
61#define SEL_ACTION_ENABLED 0x800U
62/* Selective Actions flags */
44 63
64#ifndef HAS_BUTTON_HOLD
65bool is_keys_locked(void);
66void set_selective_softlock_actions(bool selective, unsigned int mask);
67#endif
68
69#ifdef HAVE_BACKLIGHT
70void set_selective_backlight_actions(bool selective, unsigned int mask,
71 bool filter_fkp);
72#endif
73#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
45enum { 74enum {
46 CONTEXT_STD = 0, 75 CONTEXT_STD = 0,
47 /* These CONTEXT_ values were here before me, 76 /* These CONTEXT_ values were here before me,
48 there values may have significance, so dont touch! */ 77 there values may have significance, so dont touch! */
49 CONTEXT_WPS = 1, 78 CONTEXT_WPS = 1,
50 CONTEXT_TREE = 2, 79 CONTEXT_TREE = 2,
51 CONTEXT_RECORD = 3, 80 CONTEXT_RECORD = 3,
52 CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */ 81 CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */
53 CONTEXT_ID3DB = 5, 82 CONTEXT_ID3DB = 5,
54 /* Add new contexts here, no need to explicitly define a value for them */ 83 /* Add new contexts here, no need to explicitly define a value for them */
55 CONTEXT_LIST, 84 CONTEXT_LIST,
56 CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */ 85 CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
57 /* bellow are setting screens which may need to redefine the standard 86 /* bellow are setting screens which may need to redefine the standard
58 setting screen keys, targets should return the CONTEXT_SETTINGS 87 setting screen keys, targets should return the CONTEXT_SETTINGS
59 keymap unless they are not adequate for the screen 88 keymap unless they are not adequate for the screen
60 NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also 89 NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
61 and (possibly) ACTION_SETTINGS_[INC|DEC] */ 90 and (possibly) ACTION_SETTINGS_[INC|DEC] */
62 CONTEXT_SETTINGS_EQ, 91 CONTEXT_SETTINGS_EQ,
63 CONTEXT_SETTINGS_COLOURCHOOSER, 92 CONTEXT_SETTINGS_COLOURCHOOSER,
64 CONTEXT_SETTINGS_TIME, 93 CONTEXT_SETTINGS_TIME,
65 CONTEXT_SETTINGS_RECTRIGGER, 94 CONTEXT_SETTINGS_RECTRIGGER,
66 95
67 /* The following contexts should use ACTION_STD_[NEXT|PREV] 96 /* The following contexts should use ACTION_STD_[NEXT|PREV]
68 and (possibly) ACTION_SETTINGS_[INC|DEC] 97 and (possibly) ACTION_SETTINGS_[INC|DEC]
69 Also add any extra actions they need */ 98 Also add any extra actions they need */
70 CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */ 99 CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
71 CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */ 100 CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
72 CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */ 101 CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
73 CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */ 102 CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
74 103
75 CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */ 104 CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
76 CONTEXT_RECSCREEN, 105 CONTEXT_RECSCREEN,
77 CONTEXT_KEYBOARD, 106 CONTEXT_KEYBOARD,
@@ -86,7 +115,7 @@ enum {
86 115
87 116
88enum { 117enum {
89 118
90 ACTION_NONE = BUTTON_NONE, 119 ACTION_NONE = BUTTON_NONE,
91 ACTION_UNKNOWN, 120 ACTION_UNKNOWN,
92 ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ 121 ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
@@ -95,11 +124,11 @@ enum {
95 ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */ 124 ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */
96 125
97 /* standard actions, use these first */ 126 /* standard actions, use these first */
98 ACTION_STD_PREV, 127 ACTION_STD_PREV,
99 ACTION_STD_PREVREPEAT, 128 ACTION_STD_PREVREPEAT,
100 ACTION_STD_NEXT, 129 ACTION_STD_NEXT,
101 ACTION_STD_NEXTREPEAT, 130 ACTION_STD_NEXTREPEAT,
102 131
103 ACTION_STD_OK, 132 ACTION_STD_OK,
104 ACTION_STD_CANCEL, 133 ACTION_STD_CANCEL,
105 ACTION_STD_CONTEXT, 134 ACTION_STD_CONTEXT,
@@ -108,10 +137,10 @@ enum {
108 ACTION_STD_KEYLOCK, 137 ACTION_STD_KEYLOCK,
109 ACTION_STD_REC, 138 ACTION_STD_REC,
110 ACTION_STD_HOTKEY, 139 ACTION_STD_HOTKEY,
111 140
112 ACTION_F3, /* just so everything works again, possibly change me */ 141 ACTION_F3, /* just so everything works again, possibly change me */
113 /* code context actions */ 142 /* code context actions */
114 143
115 /* WPS codes */ 144 /* WPS codes */
116 ACTION_WPS_BROWSE, 145 ACTION_WPS_BROWSE,
117 ACTION_WPS_PLAY, 146 ACTION_WPS_PLAY,
@@ -133,7 +162,7 @@ enum {
133 ACTION_WPS_CREATE_BOOKMARK,/* optional */ 162 ACTION_WPS_CREATE_BOOKMARK,/* optional */
134 ACTION_WPS_REC, 163 ACTION_WPS_REC,
135#if 0 164#if 0
136 ACTION_WPSAB_SINGLE, /* This needs to be #defined in 165 ACTION_WPSAB_SINGLE, /* This needs to be #defined in
137 the config-<target>.h to one of the ACTION_WPS_ actions 166 the config-<target>.h to one of the ACTION_WPS_ actions
138 so it can be used */ 167 so it can be used */
139#endif 168#endif
@@ -141,23 +170,23 @@ enum {
141 ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */ 170 ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
142 ACTION_WPS_ABRESET, 171 ACTION_WPS_ABRESET,
143 ACTION_WPS_HOTKEY, 172 ACTION_WPS_HOTKEY,
144 173
145 /* list and tree page up/down */ 174 /* list and tree page up/down */
146 ACTION_LISTTREE_PGUP,/* optional */ 175 ACTION_LISTTREE_PGUP,/* optional */
147 ACTION_LISTTREE_PGDOWN,/* optional */ 176 ACTION_LISTTREE_PGDOWN,/* optional */
148#ifdef HAVE_VOLUME_IN_LIST 177#ifdef HAVE_VOLUME_IN_LIST
149 ACTION_LIST_VOLUP, 178 ACTION_LIST_VOLUP,
150 ACTION_LIST_VOLDOWN, 179 ACTION_LIST_VOLDOWN,
151#endif 180#endif
152 181
153 /* tree */ 182 /* tree */
154 ACTION_TREE_ROOT_INIT, 183 ACTION_TREE_ROOT_INIT,
155 ACTION_TREE_PGLEFT,/* optional */ 184 ACTION_TREE_PGLEFT,/* optional */
156 ACTION_TREE_PGRIGHT,/* optional */ 185 ACTION_TREE_PGRIGHT,/* optional */
157 ACTION_TREE_STOP, 186 ACTION_TREE_STOP,
158 ACTION_TREE_WPS, 187 ACTION_TREE_WPS,
159 ACTION_TREE_HOTKEY, 188 ACTION_TREE_HOTKEY,
160 189
161 /* radio */ 190 /* radio */
162 ACTION_FM_MENU, 191 ACTION_FM_MENU,
163 ACTION_FM_PRESET, 192 ACTION_FM_PRESET,
@@ -177,7 +206,7 @@ enum {
177 ACTION_REC_NEWFILE, 206 ACTION_REC_NEWFILE,
178 ACTION_REC_F2, 207 ACTION_REC_F2,
179 ACTION_REC_F3, 208 ACTION_REC_F3,
180 209
181 /* main menu */ 210 /* main menu */
182 /* These are not strictly actions, but must be here 211 /* These are not strictly actions, but must be here
183 so they dont conflict with real actions in the menu code */ 212 so they dont conflict with real actions in the menu code */
@@ -186,11 +215,11 @@ enum {
186 ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit 215 ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
187 once the subitem returns */ 216 once the subitem returns */
188 ACTION_ENTER_MENUITEM, 217 ACTION_ENTER_MENUITEM,
189 218
190 /* id3db */ 219 /* id3db */
191 220
192 /* list */ 221 /* list */
193 222
194 /* settings */ 223 /* settings */
195 ACTION_SETTINGS_INC, 224 ACTION_SETTINGS_INC,
196 ACTION_SETTINGS_INCREPEAT, 225 ACTION_SETTINGS_INCREPEAT,
@@ -200,16 +229,16 @@ enum {
200 ACTION_SETTINGS_DECBIGSTEP, 229 ACTION_SETTINGS_DECBIGSTEP,
201 ACTION_SETTINGS_RESET, 230 ACTION_SETTINGS_RESET,
202 ACTION_SETTINGS_SET, /* Used by touchscreen targets */ 231 ACTION_SETTINGS_SET, /* Used by touchscreen targets */
203 232
204 /* bookmark screen */ 233 /* bookmark screen */
205 ACTION_BMS_DELETE, 234 ACTION_BMS_DELETE,
206 235
207 /* quickscreen */ 236 /* quickscreen */
208 ACTION_QS_LEFT, 237 ACTION_QS_LEFT,
209 ACTION_QS_RIGHT, 238 ACTION_QS_RIGHT,
210 ACTION_QS_DOWN, 239 ACTION_QS_DOWN,
211 ACTION_QS_TOP, 240 ACTION_QS_TOP,
212 241
213 /* pitchscreen */ 242 /* pitchscreen */
214 /* obviously ignore if you dont have thise screen */ 243 /* obviously ignore if you dont have thise screen */
215 ACTION_PS_INC_SMALL, 244 ACTION_PS_INC_SMALL,
@@ -225,10 +254,10 @@ enum {
225 ACTION_PS_EXIT, /* _STD_* isnt going to work here */ 254 ACTION_PS_EXIT, /* _STD_* isnt going to work here */
226 ACTION_PS_SLOWER, 255 ACTION_PS_SLOWER,
227 ACTION_PS_FASTER, 256 ACTION_PS_FASTER,
228 257
229 /* yesno screen */ 258 /* yesno screen */
230 ACTION_YESNO_ACCEPT, 259 ACTION_YESNO_ACCEPT,
231 260
232 /* keyboard screen */ 261 /* keyboard screen */
233 ACTION_KBD_LEFT, 262 ACTION_KBD_LEFT,
234 ACTION_KBD_RIGHT, 263 ACTION_KBD_RIGHT,
@@ -243,7 +272,7 @@ enum {
243 ACTION_KBD_DOWN, 272 ACTION_KBD_DOWN,
244 ACTION_KBD_MORSE_INPUT, 273 ACTION_KBD_MORSE_INPUT,
245 ACTION_KBD_MORSE_SELECT, 274 ACTION_KBD_MORSE_SELECT,
246 275
247#ifdef HAVE_TOUCHSCREEN 276#ifdef HAVE_TOUCHSCREEN
248 /* the following are helper actions for touchscreen targets, 277 /* the following are helper actions for touchscreen targets,
249 * These are for actions which are not doable or required if buttons are 278 * These are for actions which are not doable or required if buttons are
@@ -255,7 +284,7 @@ enum {
255 ACTION_TOUCH_VOLUME, 284 ACTION_TOUCH_VOLUME,
256 ACTION_TOUCH_SOFTLOCK, 285 ACTION_TOUCH_SOFTLOCK,
257 ACTION_TOUCH_SETTING, 286 ACTION_TOUCH_SETTING,
258#endif 287#endif
259 288
260 /* USB HID codes */ 289 /* USB HID codes */
261 ACTION_USB_HID_FIRST, /* Place holder */ 290 ACTION_USB_HID_FIRST, /* Place holder */
@@ -347,11 +376,8 @@ bool action_userabort(int timeout);
347 376
348/* no other code should need this apart from action.c */ 377/* no other code should need this apart from action.c */
349const struct button_mapping* get_context_mapping(int context); 378const struct button_mapping* get_context_mapping(int context);
350#ifndef HAS_BUTTON_HOLD
351bool is_keys_locked(void);
352#endif
353 379
354/* returns the status code variable from action.c for the button just pressed 380/* returns the status code variable from action.c for the button just pressed
355 If button != NULL it will be set to the actual button code */ 381 If button != NULL it will be set to the actual button code */
356#define ACTION_REMOTE 0x1 /* remote was pressed */ 382#define ACTION_REMOTE 0x1 /* remote was pressed */
357#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */ 383#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
@@ -378,7 +404,7 @@ int action_get_touchscreen_press(short *x, short *y);
378 * the press was within the viewport, 404 * the press was within the viewport,
379 * ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside 405 * ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside
380 * BUTTON_NONE else 406 * BUTTON_NONE else
381 * 407 *
382 **/ 408 **/
383int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp); 409int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);
384#endif 410#endif