summaryrefslogtreecommitdiff
path: root/apps/action.h
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-04-02 21:34:29 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2022-02-23 08:47:12 -0500
commitf7bb9e21672566308ab837c370f27c10c154e6fc (patch)
tree688aa4e1a44572452ee192838b0af510b57ce770 /apps/action.h
parent7952687185aa27fcecc0924efa45c0e64e0ed4fe (diff)
downloadrockbox-f7bb9e21672566308ab837c370f27c10c154e6fc.tar.gz
rockbox-f7bb9e21672566308ab837c370f27c10c154e6fc.zip
Add custom action mapping to core
results of an idea I discussed in IRC changed the way the lookup in the remap file works.. entries consist of 3 int [action, button, prebtn] context look up table is at the beginning action_code contains the (context | CONTEXT_REMAPPED) button_code contains the index of the first remapped action for the matched context [0] CORE_CONTEXT_REMAP(ctx1) offset1=(3), count=(1) [1] CORE_CONTEXT_REMAP(ctx2, offset2=(5), count=(1) [2] sentinel, 0, 0 [3] act0, btn, 0 [4] sentinel 0, 0 [5] act1, btn, 0 [6] sentinel, 0, 0 Note: last entry of each group is always the sentinel [CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE] contexts must match exactly -- re-mapped contexts run before the built in w/ fall through contexts ie. you can't remap std_context and expect it to match std_context actions from the WPS context. -- Done -- Code for reading core remap entries -- Done -- import of core remap entires from disk -- Done -- plugin to set new key mapping (the hard part) The plugin is started and FULLY functional you can add actions and contexts you can change context, action, button, prebtn delete keymap files load keymapfiles save user keymaps test keymaps before applying them loading keymaps to core still requires restart ----------------------------------------------------------------------------------------------- Change-Id: Ib8b88c5ae91af4d540e1829de5db32669cd68203
Diffstat (limited to 'apps/action.h')
-rw-r--r--apps/action.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/action.h b/apps/action.h
index 3217ce4d6f..7fadc015c8 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -28,10 +28,13 @@
28#define TIMEOUT_NOBLOCK 0 28#define TIMEOUT_NOBLOCK 0
29 29
30#define CONTEXT_STOPSEARCHING 0xFFFFFFFF 30#define CONTEXT_STOPSEARCHING 0xFFFFFFFF
31
31#define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ 32#define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */
32#define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ 33#define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */
33#define CONTEXT_CUSTOM2 0x20000000 /* as above */ 34#define CONTEXT_CUSTOM2 0x20000000 /* as above */
34#define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */ 35#define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */
36#define CONTEXT_REMAPPED 0x08000000 /* marker for key remap context table */
37#define CORE_CONTEXT_REMAP(context) (CONTEXT_REMAPPED | context)
35#ifdef HAVE_LOCKED_ACTIONS 38#ifdef HAVE_LOCKED_ACTIONS
36#define CONTEXT_LOCKED 0x04000000 /* flag to use alternate keymap when screen is locked */ 39#define CONTEXT_LOCKED 0x04000000 /* flag to use alternate keymap when screen is locked */
37#endif 40#endif
@@ -415,6 +418,11 @@ typedef struct
415 bool repeated; 418 bool repeated;
416 bool wait_for_release; 419 bool wait_for_release;
417 420
421#ifndef DISABLE_ACTION_REMAP
422 bool check_remap;
423 struct button_mapping* core_keymap;
424#endif
425
418#ifdef HAVE_TOUCHSCREEN 426#ifdef HAVE_TOUCHSCREEN
419 bool ts_short_press; 427 bool ts_short_press;
420 int ts_data; 428 int ts_data;
@@ -441,6 +449,9 @@ bool action_userabort(int timeout);
441/* no other code should need this apart from action.c */ 449/* no other code should need this apart from action.c */
442const struct button_mapping* get_context_mapping(int context); 450const struct button_mapping* get_context_mapping(int context);
443 451
452/* load a key map to allow buttons for actions to be remapped see: core_keymap */
453int action_set_keymap(struct button_mapping* core_button_map, int count);
454
444/* returns the status code variable from action.c for the button just pressed 455/* returns the status code variable from action.c for the button just pressed
445 If button != NULL it will be set to the actual button code */ 456 If button != NULL it will be set to the actual button code */
446#define ACTION_REMOTE 0x1 /* remote was pressed */ 457#define ACTION_REMOTE 0x1 /* remote was pressed */