summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-11-03 14:34:57 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-11-03 14:34:57 +0000
commita41041aeb431c259dc79a203821e81b00c63ebe9 (patch)
tree63f42bc3a4141e52f9c7f37396fa20d1ab10e066 /apps
parent45fa8245eaf3f8d8a2ff95eae7509a9d3af26c3d (diff)
downloadrockbox-a41041aeb431c259dc79a203821e81b00c63ebe9.tar.gz
rockbox-a41041aeb431c259dc79a203821e81b00c63ebe9.zip
Remote android button handling (again). do the press/unpress more like other targets (i.e correctly). The DPAD is special in that the press/unpress happens too quickly, so always post it with the BUTTON_REL. This means all keymaps using the dpad need to remember it will always have a BUTTON_REL (which also means they cant do repeats, which are impossible anyway).
Also make the back button go back to the OS home from the rockbox main menu git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28475 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/keymaps/keymap-android.c46
-rw-r--r--apps/root_menu.c8
2 files changed, 22 insertions, 32 deletions
diff --git a/apps/keymaps/keymap-android.c b/apps/keymaps/keymap-android.c
index cbc20c3e67..939adb8d0a 100644
--- a/apps/keymaps/keymap-android.c
+++ b/apps/keymaps/keymap-android.c
@@ -38,15 +38,14 @@
38 */ 38 */
39 39
40static const struct button_mapping button_context_standard[] = { 40static const struct button_mapping button_context_standard[] = {
41 { ACTION_STD_PREV, BUTTON_DPAD_UP, BUTTON_NONE }, 41 { ACTION_STD_PREV, BUTTON_DPAD_UP|BUTTON_REL, BUTTON_NONE },
42 { ACTION_STD_PREVREPEAT, BUTTON_DPAD_UP|BUTTON_REPEAT, BUTTON_NONE }, 42 { ACTION_STD_NEXT, BUTTON_DPAD_DOWN|BUTTON_REL, BUTTON_NONE },
43 { ACTION_STD_NEXT, BUTTON_DPAD_DOWN, BUTTON_NONE },
44 { ACTION_STD_NEXTREPEAT, BUTTON_DPAD_DOWN|BUTTON_REPEAT, BUTTON_NONE },
45 43
46 { ACTION_STD_OK, BUTTON_DPAD_CENTER|BUTTON_REL, BUTTON_DPAD_CENTER }, 44 { ACTION_STD_OK, BUTTON_DPAD_CENTER, BUTTON_NONE },
47 { ACTION_STD_OK, BUTTON_DPAD_RIGHT|BUTTON_REL, BUTTON_DPAD_RIGHT }, 45 { ACTION_STD_OK, BUTTON_DPAD_RIGHT|BUTTON_REL, BUTTON_NONE },
48 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, 46 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
49 { ACTION_STD_CANCEL, BUTTON_DPAD_LEFT|BUTTON_REL, BUTTON_DPAD_LEFT }, 47 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
48 { ACTION_STD_CANCEL, BUTTON_DPAD_LEFT|BUTTON_REL, BUTTON_NONE },
50 49
51 { ACTION_STD_CONTEXT, BUTTON_MENU, BUTTON_NONE }, 50 { ACTION_STD_CONTEXT, BUTTON_MENU, BUTTON_NONE },
52 51
@@ -78,12 +77,10 @@ static const struct button_mapping button_context_listtree_scroll_without_combo[
78}; 77};
79 78
80static const struct button_mapping button_context_settings[] = { 79static const struct button_mapping button_context_settings[] = {
81 { ACTION_SETTINGS_INC, BUTTON_DPAD_RIGHT, BUTTON_NONE }, 80 { ACTION_SETTINGS_INC, BUTTON_DPAD_RIGHT|BUTTON_REL, BUTTON_NONE },
82 { ACTION_SETTINGS_INCREPEAT, BUTTON_DPAD_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 81 { ACTION_SETTINGS_DEC, BUTTON_DPAD_LEFT|BUTTON_REL, BUTTON_NONE },
83 { ACTION_SETTINGS_DEC, BUTTON_DPAD_LEFT, BUTTON_NONE }, 82 { ACTION_STD_OK, BUTTON_DPAD_CENTER, BUTTON_NONE },
84 { ACTION_SETTINGS_DECREPEAT, BUTTON_DPAD_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 83 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
85 { ACTION_STD_OK, BUTTON_DPAD_CENTER, BUTTON_NONE },
86 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
87 84
88 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 85 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
89}; /* button_context_settings */ 86}; /* button_context_settings */
@@ -124,24 +121,13 @@ static const struct button_mapping button_context_quickscreen[] = {
124 121
125static const struct button_mapping button_context_pitchscreen[] = { 122static const struct button_mapping button_context_pitchscreen[] = {
126 123
127 { ACTION_PS_INC_SMALL, BUTTON_DPAD_RIGHT, BUTTON_NONE }, 124 { ACTION_PS_INC_SMALL, BUTTON_DPAD_RIGHT|BUTTON_REL, BUTTON_NONE },
128 { ACTION_PS_INC_BIG, BUTTON_DPAD_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 125 { ACTION_PS_DEC_SMALL, BUTTON_DPAD_LEFT|BUTTON_REL, BUTTON_NONE },
129 { ACTION_PS_DEC_SMALL, BUTTON_DPAD_LEFT, BUTTON_NONE }, 126 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
130 { ACTION_PS_DEC_BIG, BUTTON_DPAD_LEFT|BUTTON_REPEAT, BUTTON_NONE },
131 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
132 127
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
134}; /* button_context_pitchcreen */ 129}; /* button_context_pitchcreen */
135 130
136static const struct button_mapping button_context_keyboard[] = {
137 { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE },
138 { ACTION_KBD_CURSOR_LEFT, BUTTON_DPAD_LEFT, BUTTON_NONE },
139 { ACTION_KBD_CURSOR_LEFT, BUTTON_DPAD_LEFT|BUTTON_REPEAT, BUTTON_NONE },
140 { ACTION_KBD_CURSOR_RIGHT, BUTTON_DPAD_RIGHT, BUTTON_NONE },
141 { ACTION_KBD_CURSOR_RIGHT, BUTTON_DPAD_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
142
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144}; /* button_context_keyboard */
145 131
146static const struct button_mapping button_context_radio[] = { 132static const struct button_mapping button_context_radio[] = {
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) 133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
@@ -181,8 +167,6 @@ const struct button_mapping* target_get_context_mapping(int context)
181 case CONTEXT_SETTINGS_TIME: 167 case CONTEXT_SETTINGS_TIME:
182 return button_context_time; 168 return button_context_time;
183 169
184 case CONTEXT_YESNOSCREEN:
185 return button_context_yesno;
186 case CONTEXT_FM: 170 case CONTEXT_FM:
187 return button_context_radio; 171 return button_context_radio;
188 case CONTEXT_BOOKMARKSCREEN: 172 case CONTEXT_BOOKMARKSCREEN:
@@ -191,8 +175,6 @@ const struct button_mapping* target_get_context_mapping(int context)
191 return button_context_quickscreen; 175 return button_context_quickscreen;
192 case CONTEXT_PITCHSCREEN: 176 case CONTEXT_PITCHSCREEN:
193 return button_context_pitchscreen; 177 return button_context_pitchscreen;
194 case CONTEXT_KEYBOARD:
195 return button_context_keyboard;
196 } 178 }
197 return button_context_standard; 179 return button_context_standard;
198} 180}
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 5a8d40f0b6..a65ceb51b9 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -639,7 +639,15 @@ void root_menu(void)
639 case GO_TO_ROOT: 639 case GO_TO_ROOT:
640 if (last_screen != GO_TO_ROOT) 640 if (last_screen != GO_TO_ROOT)
641 selected = get_selection(last_screen); 641 selected = get_selection(last_screen);
642#if (CONFIG_PLATFORM&PLATFORM_ANDROID)
643 /* When we are in the main menu we want the hardware BACK
644 * button to be handled by Android instead of rockbox */
645 android_ignore_back_button(true);
646#endif
642 next_screen = do_menu(&root_menu_, &selected, NULL, false); 647 next_screen = do_menu(&root_menu_, &selected, NULL, false);
648#if (CONFIG_PLATFORM&PLATFORM_ANDROID)
649 android_ignore_back_button(false);
650#endif
643 if (next_screen != GO_TO_PREVIOUS) 651 if (next_screen != GO_TO_PREVIOUS)
644 last_screen = GO_TO_ROOT; 652 last_screen = GO_TO_ROOT;
645 break; 653 break;