diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-09-12 05:03:12 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-09-13 16:23:24 +0000 |
commit | c62493e98adfd27c16eb2adb2ecd22716813b705 (patch) | |
tree | c5d2a0fbdcf145584518289885e7676f82b20a29 /apps | |
parent | 6b674a6a0a347bd4cb946b37b6e075dc2715f7ac (diff) |
Xduoo X3 Add tree scrolling FS#13240, Emulate Multibutton presses
Fixes deficiencies with the button system on the X3
The x3 has an interesting button layout.
Multiple key presses are NOT supported unless
[BUTTON_POWER] is one of the combined keys
As you can imagine this causes problems as the power button takes
precedence in the button system and initiates a shutdown if the
key is held too long
instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys
IF using as a prerequsite button then BUTTON_POWER should be used
Multiple buttons are emulated by button_read_device but there are a few
caveats to be aware of:
Button Order Matters!
different keys have different priorities, higher priority keys 'overide'
the lower priority keys
VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1]
There will be no true release or repeat events, the user can let off the
button pressed initially and it will still continue to appear to be
pressed as long as the second key is held
Tree scrolling is PLAY+NEXT or PLAY+PREV
Change-Id: I88dfee1c70a6a99659e8227f5becacc50cc43910
Diffstat (limited to 'apps')
-rw-r--r-- | apps/keymaps/keymap-xduoox3.c | 44 | ||||
-rw-r--r-- | apps/plugins/doom/i_video.c | 2 | ||||
-rw-r--r-- | apps/plugins/fft/fft.c | 2 | ||||
-rw-r--r-- | apps/plugins/goban/goban.h | 2 | ||||
-rw-r--r-- | apps/plugins/imageviewer/imageviewer_button.h | 2 | ||||
-rw-r--r-- | apps/plugins/pegbox.c | 2 | ||||
-rw-r--r-- | apps/plugins/rockpaint.c | 2 | ||||
-rw-r--r-- | apps/plugins/sliding_puzzle.c | 2 | ||||
-rw-r--r-- | apps/plugins/sokoban.c | 2 | ||||
-rw-r--r-- | apps/plugins/sudoku/sudoku.h | 2 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_button.h | 2 | ||||
-rw-r--r-- | apps/plugins/wormlet.c | 2 |
12 files changed, 51 insertions, 15 deletions
diff --git a/apps/keymaps/keymap-xduoox3.c b/apps/keymaps/keymap-xduoox3.c index e73798d4fe..ed217fd722 100644 --- a/apps/keymaps/keymap-xduoox3.c +++ b/apps/keymaps/keymap-xduoox3.c @@ -21,6 +21,29 @@ /* Button Code Definitions for xDuoo X3 target */ + +/* NOTE X3 Button system + * The x3 has an interesting button layout. Multiple key presses are + * NOT supported unless [BUTTON_POWER] is one of the combined keys + * as you can imagine this causes problems as the power button takes + * precedence in the button system and initiates a shutdown if the + * key is held too long + * instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys + * IF using as a prerequsite button then BUTTON_POWER should be used + * + * Multiple buttons are emulated by button_read_device but there are a few + * caveats to be aware of: + * + * Button Order Matters! + * different keys have different priorities, higher priority keys 'overide' the + * lower priority keys + * VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1] + * + * There will be no true release or repeat events, the user can let off the button + * pressed initially and it will still continue to appear to be pressed as long as + * the second key is held + * */ + #include "config.h" #include "action.h" #include "button.h" @@ -67,9 +90,9 @@ static const struct button_mapping button_context_wps[] = { { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, - { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_NEXT, BUTTON_POWER }, - { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_PREV, BUTTON_POWER }, - { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_PLAY, BUTTON_POWER }, + { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_PWRALT|BUTTON_NEXT, BUTTON_POWER }, + { ACTION_WPS_ABSETA_PREVDIR, BUTTON_PWRALT|BUTTON_PREV, BUTTON_POWER }, + { ACTION_WPS_ABRESET, BUTTON_PWRALT|BUTTON_PLAY, BUTTON_POWER }, LAST_ITEM_IN_LIST }; /* button_context_wps */ @@ -173,11 +196,21 @@ static const struct button_mapping button_context_settings_vol_is_inc[] = { static const struct button_mapping button_context_tree[] = { { ACTION_TREE_WPS, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, - { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, + { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME}, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) }; /* button_context_tree */ +static const struct button_mapping button_context_listtree_scroll_with_combo[] = { + { ACTION_NONE, BUTTON_POWER, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_PREV, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_NEXT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), +}; /* button_context_listtree_scroll_with_combo */ + /** Yes/No Screen **/ static const struct button_mapping button_context_yesnoscreen[] = { { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, @@ -256,8 +289,11 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_SETTINGS_RECTRIGGER: return button_context_settings_vol_is_inc; case CONTEXT_TREE: + return button_context_listtree_scroll_with_combo; case CONTEXT_MAINMENU: return button_context_tree; + case CONTEXT_CUSTOM|CONTEXT_TREE: + return button_context_tree; case CONTEXT_WPS: return button_context_wps; case CONTEXT_YESNOSCREEN: diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index 9f367d7d76..fb328639bf 100644 --- a/apps/plugins/doom/i_video.c +++ b/apps/plugins/doom/i_video.c @@ -561,7 +561,7 @@ void I_ShutdownGraphics(void) #define DOOMBUTTON_LEFT BUTTON_PREV #define DOOMBUTTON_RIGHT BUTTON_NEXT #define DOOMBUTTON_SHOOT BUTTON_PLAY -#define DOOMBUTTON_OPEN (BUTTON_HOME | BUTTON_POWER) +#define DOOMBUTTON_OPEN (BUTTON_HOME | BUTTON_PWRALT) #define DOOMBUTTON_ESC BUTTON_POWER #define DOOMBUTTON_ENTER BUTTON_PLAY #define DOOMBUTTON_WEAPON BUTTON_VOL_UP diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index 9edb02a15e..2ed0263d75 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -330,7 +330,7 @@ GREY_INFO_STRUCT # define FFT_NEXT_GRAPH BUTTON_NEXT # define FFT_ORIENTATION BUTTON_HOME # define FFT_FREQ_SCALE BUTTON_OPTION -# define FFT_WINDOW (BUTTON_HOME|BUTTON_POWER) +# define FFT_WINDOW (BUTTON_HOME|BUTTON_PWRALT) # define FFT_AMP_SCALE BUTTON_PLAY # define FFT_QUIT BUTTON_POWER diff --git a/apps/plugins/goban/goban.h b/apps/plugins/goban/goban.h index 8406b540b7..ac02d74f50 100644 --- a/apps/plugins/goban/goban.h +++ b/apps/plugins/goban/goban.h @@ -441,7 +441,7 @@ #define GBN_BUTTON_MENU BUTTON_POWER #define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT -#define GBN_BUTTON_NEXT_VAR BUTTON_HOME | BUTTON_POWER +#define GBN_BUTTON_NEXT_VAR BUTTON_HOME | BUTTON_PWRALT #elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) #define GBN_BUTTON_UP BUTTON_HOME diff --git a/apps/plugins/imageviewer/imageviewer_button.h b/apps/plugins/imageviewer/imageviewer_button.h index 46813d5e69..7aa96023c6 100644 --- a/apps/plugins/imageviewer/imageviewer_button.h +++ b/apps/plugins/imageviewer/imageviewer_button.h @@ -474,7 +474,7 @@ #define IMGVIEW_PREVIOUS BUTTON_VOL_DOWN #define IMGVIEW_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT) #define IMGVIEW_MENU BUTTON_POWER -#define IMGVIEW_SLIDE_SHOW (BUTTON_HOME|BUTTON_POWER) +#define IMGVIEW_SLIDE_SHOW (BUTTON_HOME|BUTTON_PWRALT) #elif CONFIG_KEYPAD == XDUOO_X3II_PAD #define IMGVIEW_ZOOM_PRE BUTTON_PLAY diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index 4622d2a10e..0a299c995f 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c @@ -612,7 +612,7 @@ CONFIG_KEYPAD == MROBE500_PAD #elif CONFIG_KEYPAD == XDUOO_X3_PAD #define PEGBOX_SELECT BUTTON_PLAY #define PEGBOX_QUIT BUTTON_POWER -#define PEGBOX_RESTART (BUTTON_POWER | BUTTON_HOME) +#define PEGBOX_RESTART (BUTTON_PWRALT | BUTTON_HOME) #define PEGBOX_LVL_UP BUTTON_VOL_UP #define PEGBOX_LVL_DOWN BUTTON_VOL_DOWN #define PEGBOX_UP BUTTON_HOME diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 35d2f21ba7..8e4df10280 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -330,7 +330,7 @@ #elif CONFIG_KEYPAD == XDUOO_X3_PAD #define ROCKPAINT_QUIT BUTTON_POWER #define ROCKPAINT_DRAW BUTTON_PLAY -#define ROCKPAINT_MENU (BUTTON_HOME | BUTTON_POWER) +#define ROCKPAINT_MENU (BUTTON_HOME | BUTTON_PWRALT) #define ROCKPAINT_TOOLBAR BUTTON_VOL_UP #define ROCKPAINT_TOOLBAR2 BUTTON_VOL_DOWN #define ROCKPAINT_UP BUTTON_HOME diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 1a77eda721..e8d349defd 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -309,7 +309,7 @@ CONFIG_KEYPAD == MROBE500_PAD #define PUZZLE_RIGHT BUTTON_NEXT #define PUZZLE_UP BUTTON_HOME #define PUZZLE_DOWN BUTTON_OPTION -#define PUZZLE_SHUFFLE (BUTTON_HOME | BUTTON_POWER) +#define PUZZLE_SHUFFLE (BUTTON_HOME | BUTTON_PWRALT) #define PUZZLE_PICTURE BUTTON_PLAY #elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 3cc1555e83..08359d9fcc 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -623,7 +623,7 @@ #define SOKOBAN_MENU BUTTON_POWER #define SOKOBAN_UNDO_PRE BUTTON_PLAY #define SOKOBAN_UNDO (BUTTON_PLAY | BUTTON_REL) -#define SOKOBAN_REDO (BUTTON_POWER | BUTTON_PLAY) +#define SOKOBAN_REDO (BUTTON_PWRALT | BUTTON_PLAY) #define SOKOBAN_LEVEL_DOWN BUTTON_VOL_DOWN #define SOKOBAN_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_NEXT) #define SOKOBAN_LEVEL_UP BUTTON_VOL_UP diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h index d1eca7fcd4..434223ef68 100644 --- a/apps/plugins/sudoku/sudoku.h +++ b/apps/plugins/sudoku/sudoku.h @@ -402,7 +402,7 @@ #define SUDOKU_BUTTON_ALTTOGGLE BUTTON_PLAY #define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER #define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL) -#define SUDOKU_BUTTON_POSSIBLE (BUTTON_HOME | BUTTON_POWER) +#define SUDOKU_BUTTON_POSSIBLE (BUTTON_HOME | BUTTON_PWRALT) #elif CONFIG_KEYPAD == XDUOO_X3II_PAD #define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER diff --git a/apps/plugins/text_viewer/tv_button.h b/apps/plugins/text_viewer/tv_button.h index 4f7634e844..6fcfc24e4f 100644 --- a/apps/plugins/text_viewer/tv_button.h +++ b/apps/plugins/text_viewer/tv_button.h @@ -504,7 +504,7 @@ #define TV_SCREEN_LEFT BUTTON_PREV #define TV_SCREEN_RIGHT BUTTON_NEXT #define TV_MENU BUTTON_PLAY -#define TV_AUTOSCROLL (BUTTON_POWER | BUTTON_HOME) +#define TV_AUTOSCROLL (BUTTON_PWRALT | BUTTON_HOME) #define TV_LINE_UP BUTTON_HOME #define TV_LINE_DOWN BUTTON_OPTION #define TV_BOOKMARK (BUTTON_OPTION | BUTTON_PLAY) diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index 419b258fe5..59f3138c0a 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c @@ -360,7 +360,7 @@ CONFIG_KEYPAD == MROBE500_PAD #define BTN_DIR_RIGHT BUTTON_NEXT #define BTN_STARTPAUSE BUTTON_PLAY #define BTN_QUIT BUTTON_POWER -#define BTN_STOPRESET (BUTTON_HOME | BUTTON_POWER) +#define BTN_STOPRESET (BUTTON_HOME | BUTTON_PWRALT) #elif CONFIG_KEYPAD == XDUOO_X3II_PAD #define BTN_DIR_UP BUTTON_HOME |