Fix wrong button used in touchscreen keymap
[kugel-rb.git] / apps / keymaps / keymap-touchscreen.c
blobbe6e170a1eeaec34b7344e7b2a8026530d7e810b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for touchscreen targets */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
30 #include "settings.h"
32 const struct button_mapping* target_get_context_mapping(int context);
33 /* How this file is used:
34 get_context_mapping() at the bottom of the file is called by action.c as usual.
35 if the context is for the remote control its then passed straight to
36 target_get_context_mapping().
37 These tables are only used for the touchscreen buttons, so at the end of each
38 CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping()
39 (NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.)
40 In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro
41 to speed it up a tiny bit... if you dont it will go through these tables first before going
42 back to the target file.
46 /* touchscreen "buttons"
47 screen is split into a 3x3 grid for buttons...
48 BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT
49 BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT
50 BUTTON_BOTTOMLEFT BUTTON_BOTTOMMIDDLE BUTTON_BOTTOMRIGHT
53 static const struct button_mapping button_context_standard[] = {
54 { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE },
55 { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
56 { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
57 { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
60 { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
61 { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE },
62 { ACTION_STD_CANCEL, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
64 { ACTION_STD_MENU, BUTTON_TOPLEFT, BUTTON_NONE },
65 { ACTION_STD_QUICKSCREEN, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_STD_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
67 { ACTION_STD_CONTEXT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
69 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_STD)
70 }; /* button_context_standard */
72 static const struct button_mapping button_context_wps[] = {
74 { ACTION_WPS_PLAY, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
75 { ACTION_WPS_STOP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
77 { ACTION_WPS_SKIPPREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
78 { ACTION_WPS_SEEKBACK, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
79 { ACTION_WPS_STOPSEEK, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT|BUTTON_REPEAT },
81 { ACTION_WPS_SKIPNEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
82 { ACTION_WPS_SEEKFWD, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
83 { ACTION_WPS_STOPSEEK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT|BUTTON_REPEAT },
85 { ACTION_WPS_VOLUP, BUTTON_TOPMIDDLE, BUTTON_NONE },
86 { ACTION_WPS_VOLUP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_WPS_VOLDOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
88 { ACTION_WPS_VOLDOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
90 { ACTION_WPS_BROWSE, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
91 { ACTION_WPS_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
93 { ACTION_WPS_MENU, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
94 { ACTION_WPS_QUICKSCREEN, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
95 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
96 { ACTION_WPS_REC, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
97 { ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
98 { ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_WPS)
101 }; /* button_context_wps */
103 static const struct button_mapping button_context_list[] = {
104 #if 0
105 /* this is all to show how the poor-mans-gestures can be used... */
106 { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT, BUTTON_NONE},
107 { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT},
108 { ACTION_STD_NEXTREPEAT, BUTTON_CENTER, BUTTON_TOPMIDDLE},
109 { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE, BUTTON_CENTER},
110 { ACTION_NONE, BUTTON_TOPMIDDLE, BUTTON_NONE },
111 { ACTION_NONE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
112 { ACTION_STD_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE },
113 { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE },
114 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
115 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT},
116 { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE, BUTTON_CENTER},
117 { ACTION_STD_PREVREPEAT, BUTTON_CENTER, BUTTON_BOTTOMMIDDLE},
118 #endif
119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_LIST)
120 }; /* button_context_list */
122 static const struct button_mapping button_context_tree[] = {
123 { ACTION_TREE_WPS, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE)
126 }; /* button_context_tree */
128 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE),
132 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE),
136 static const struct button_mapping button_context_settings[] = {
137 { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE },
138 { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
140 { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
141 { ACTION_SETTINGS_RESET, BUTTON_CENTER, BUTTON_NONE },
143 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
144 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
145 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
146 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
147 { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE },
149 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS)
150 }; /* button_context_settings */
152 static const struct button_mapping button_context_settings_right_is_inc[] = {
153 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
154 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
155 { ACTION_SETTINGS_INC, BUTTON_MIDRIGHT, BUTTON_NONE },
156 { ACTION_SETTINGS_INCREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
157 { ACTION_SETTINGS_DEC, BUTTON_MIDLEFT, BUTTON_NONE },
158 { ACTION_SETTINGS_DECREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
159 { ACTION_SETTINGS_RESET, BUTTON_CENTER, BUTTON_NONE },
161 { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE },
163 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_SETTINGS)
164 }; /* button_context_settingsgraphical */
166 static const struct button_mapping button_context_yesno[] = {
167 { ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE },
168 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN)
169 }; /* button_context_settings_yesno */
171 static const struct button_mapping button_context_colorchooser[] = {
172 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
173 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_COLOURCHOOSER),
174 }; /* button_context_colorchooser */
176 static const struct button_mapping button_context_eq[] = {
177 /* override the std context since we're using MIDRIGHT for settings inc */
178 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
179 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
180 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_EQ),
181 }; /* button_context_eq */
183 /* Bookmark Screen */
184 static const struct button_mapping button_context_bmark[] = {
185 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_BOOKMARKSCREEN),
186 }; /* button_context_bmark */
188 static const struct button_mapping button_context_time[] = {
189 { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE },
190 { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
191 { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
192 { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
193 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
194 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
195 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
196 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
197 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
198 { ACTION_STD_CANCEL, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
199 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_TIME),
200 }; /* button_context_time */
202 static const struct button_mapping button_context_quickscreen[] = {
203 /* override ACTION_STD_CANCEL from standard context */
204 { ACTION_NONE, BUTTON_MIDLEFT, BUTTON_NONE },
206 { ACTION_STD_CANCEL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
207 { ACTION_QS_TOP, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE },
208 { ACTION_QS_TOP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
209 { ACTION_QS_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE },
210 { ACTION_QS_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
211 { ACTION_QS_LEFT, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_NONE },
212 { ACTION_QS_LEFT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
213 { ACTION_QS_RIGHT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_NONE },
214 { ACTION_QS_RIGHT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
215 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_QUICKSCREEN)
216 }; /* button_context_quickscreen */
218 static const struct button_mapping button_context_pitchscreen[] = {
220 { ACTION_PS_INC_SMALL, BUTTON_TOPMIDDLE, BUTTON_NONE },
221 { ACTION_PS_INC_BIG, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
222 { ACTION_PS_DEC_SMALL, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
223 { ACTION_PS_DEC_BIG, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_PS_NUDGE_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
225 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_NONE },
226 { ACTION_PS_NUDGE_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
227 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_NONE },
228 { ACTION_PS_TOGGLE_MODE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
229 { ACTION_PS_RESET, BUTTON_CENTER, BUTTON_NONE },
230 { ACTION_PS_EXIT, BUTTON_TOPLEFT, BUTTON_NONE },
231 { ACTION_PS_SLOWER, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
232 { ACTION_PS_FASTER, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
233 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_PITCHSCREEN)
234 }; /* button_context_pitchcreen */
236 static const struct button_mapping button_context_keyboard[] = {
238 { ACTION_KBD_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
239 { ACTION_KBD_LEFT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
240 { ACTION_KBD_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
241 { ACTION_KBD_RIGHT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
242 { ACTION_KBD_CURSOR_LEFT, BUTTON_TOPLEFT, BUTTON_NONE },
243 { ACTION_KBD_CURSOR_LEFT, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE },
244 { ACTION_KBD_CURSOR_RIGHT, BUTTON_TOPRIGHT, BUTTON_NONE },
245 { ACTION_KBD_CURSOR_RIGHT, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_NONE },
246 { ACTION_KBD_SELECT, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
247 { ACTION_KBD_DONE, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
248 { ACTION_KBD_ABORT, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
249 { ACTION_KBD_BACKSPACE, BUTTON_BOTTOMLEFT, BUTTON_NONE },
250 { ACTION_KBD_BACKSPACE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
251 { ACTION_KBD_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
252 { ACTION_KBD_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
253 { ACTION_KBD_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
254 { ACTION_KBD_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
256 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD)
257 }; /* button_context_keyboard */
259 static const struct button_mapping button_context_radio[] = {
260 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
261 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
262 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
263 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
264 { ACTION_FM_MENU, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
265 { ACTION_FM_PRESET, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
266 { ACTION_FM_EXIT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_NONE },
267 { ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE },
268 { ACTION_FM_PLAY, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_NONE },
269 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
270 }; /* button_context_radio */
272 #ifdef USB_ENABLE_HID
273 static const struct button_mapping button_context_usb_hid[] = {
274 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
275 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
277 LAST_ITEM_IN_LIST
278 }; /* button_context_usb_hid */
280 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
281 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
282 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
283 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
284 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
285 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
286 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
287 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
288 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
289 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
291 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
292 }; /* button_context_usb_hid_mode_multimedia */
294 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
295 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
296 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
297 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
298 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
299 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_MIDLEFT },
300 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
301 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
302 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
303 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_TOPMIDDLE },
304 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_TOPMIDDLE },
305 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_BOTTOMMIDDLE },
306 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_BOTTOMMIDDLE },
307 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
308 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
310 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
311 }; /* button_context_usb_hid_mode_presentation */
313 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
314 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
315 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
316 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
317 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
318 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
319 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
320 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
321 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_TOPRIGHT|BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT|BUTTON_BOTTOMRIGHT },
322 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
323 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
324 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
325 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_MIDLEFT },
326 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
327 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
329 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
330 }; /* button_context_usb_hid_mode_browser */
332 #ifdef HAVE_USB_HID_MOUSE
333 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
334 { ACTION_USB_HID_MOUSE_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
335 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
336 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
337 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT,BUTTON_NONE },
338 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
339 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
340 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
341 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
342 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_CENTER, BUTTON_NONE },
343 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
344 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_TOPRIGHT, BUTTON_NONE },
345 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_NONE },
346 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
347 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
349 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
350 }; /* button_context_usb_hid_mode_mouse */
351 #endif
352 #endif
354 const struct button_mapping* get_context_mapping(int context)
356 if (context & CONTEXT_CUSTOM2
357 #if BUTTON_REMOTE != 0
358 || context & CONTEXT_REMOTE
359 #endif
362 return target_get_context_mapping(context & ~CONTEXT_CUSTOM2);
365 switch (context)
367 case CONTEXT_STD:
368 return button_context_standard;
369 case CONTEXT_WPS:
370 return button_context_wps;
372 case CONTEXT_LIST:
373 return button_context_list;
374 case CONTEXT_MAINMENU:
375 case CONTEXT_TREE:
376 if (global_settings.hold_lr_for_scroll_in_list)
377 return button_context_listtree_scroll_without_combo;
378 else
379 return button_context_listtree_scroll_with_combo;
380 case CONTEXT_CUSTOM|CONTEXT_TREE:
381 return button_context_tree;
383 case CONTEXT_SETTINGS:
384 return button_context_settings;
385 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
386 return button_context_settings_right_is_inc;
388 case CONTEXT_SETTINGS_COLOURCHOOSER:
389 return button_context_colorchooser;
390 case CONTEXT_SETTINGS_EQ:
391 return button_context_eq;
393 case CONTEXT_SETTINGS_TIME:
394 return button_context_time;
396 case CONTEXT_YESNOSCREEN:
397 return button_context_yesno;
398 case CONTEXT_FM:
399 return button_context_radio;
400 case CONTEXT_BOOKMARKSCREEN:
401 return button_context_bmark;
402 case CONTEXT_QUICKSCREEN:
403 return button_context_quickscreen;
404 case CONTEXT_PITCHSCREEN:
405 return button_context_pitchscreen;
406 case CONTEXT_KEYBOARD:
407 return button_context_keyboard;
408 #ifdef USB_ENABLE_HID
409 case CONTEXT_USB_HID:
410 return button_context_usb_hid;
411 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
412 return button_context_usb_hid_mode_multimedia;
413 case CONTEXT_USB_HID_MODE_PRESENTATION:
414 return button_context_usb_hid_mode_presentation;
415 case CONTEXT_USB_HID_MODE_BROWSER:
416 return button_context_usb_hid_mode_browser;
417 #ifdef HAVE_USB_HID_MOUSE
418 case CONTEXT_USB_HID_MODE_MOUSE:
419 return button_context_usb_hid_mode_mouse;
420 #endif
421 #endif
422 default:
423 return button_context_standard;
425 return button_context_standard;