diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-15 21:02:47 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-15 21:02:47 +0000 |
commit | 3d0cee8abbaf764958743e8a7851eee94e60a913 (patch) | |
tree | a96b1ec825003a71643a7da4707c300f64824f82 /uisimulator/sdl/button.c | |
parent | dcf442e61f21fb2aef5ce7de0547f733557b156e (diff) | |
download | rockbox-3d0cee8abbaf764958743e8a7851eee94e60a913.tar.gz rockbox-3d0cee8abbaf764958743e8a7851eee94e60a913.zip |
- Move uisimulator/sdl/*.[ch] into the target tree, under firmware/target/hosted/sdl, uisdl.c is split up across button-sdl.c and system-sdl.c.
- Refactor the program startup. main() is now in main.c like on target, and the implicit application thread will now act as our main thread (previously a separate one was created for this in thread initialization).
This is part of Rockbox as an application and is the first step to make an application port from the uisimulator. In a further step the sim bits from the sdl build will be separated out.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26065 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/button.c')
-rw-r--r-- | uisimulator/sdl/button.c | 1907 |
1 files changed, 0 insertions, 1907 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c deleted file mode 100644 index 2bb7764782..0000000000 --- a/uisimulator/sdl/button.c +++ /dev/null | |||
@@ -1,1907 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "uisdl.h" | ||
23 | #include "lcd-charcells.h" | ||
24 | #include "lcd-remote.h" | ||
25 | #include "config.h" | ||
26 | #include "button.h" | ||
27 | #include "kernel.h" | ||
28 | #include "backlight.h" | ||
29 | #include "misc.h" | ||
30 | #include "sim_tasks.h" | ||
31 | #include "button-sdl.h" | ||
32 | #include "backlight.h" | ||
33 | |||
34 | #include "debug.h" | ||
35 | |||
36 | #ifdef HAVE_TOUCHSCREEN | ||
37 | #include "touchscreen.h" | ||
38 | static int mouse_coords = 0; | ||
39 | #endif | ||
40 | /* how long until repeat kicks in */ | ||
41 | #define REPEAT_START 6 | ||
42 | |||
43 | /* the speed repeat starts at */ | ||
44 | #define REPEAT_INTERVAL_START 4 | ||
45 | |||
46 | /* speed repeat finishes at */ | ||
47 | #define REPEAT_INTERVAL_FINISH 2 | ||
48 | |||
49 | #ifdef HAVE_TOUCHSCREEN | ||
50 | #define USB_KEY SDLK_c /* SDLK_u is taken by BUTTON_MIDLEFT */ | ||
51 | #else | ||
52 | #define USB_KEY SDLK_u | ||
53 | #endif | ||
54 | |||
55 | #if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES) | ||
56 | int _remote_type=REMOTETYPE_H100_LCD; | ||
57 | |||
58 | int remote_type(void) | ||
59 | { | ||
60 | return _remote_type; | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | struct event_queue button_queue; | ||
65 | |||
66 | static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | ||
67 | |||
68 | #ifdef HAS_BUTTON_HOLD | ||
69 | bool hold_button_state = false; | ||
70 | bool button_hold(void) { | ||
71 | return hold_button_state; | ||
72 | } | ||
73 | #endif | ||
74 | |||
75 | #ifdef HAS_REMOTE_BUTTON_HOLD | ||
76 | bool remote_hold_button_state = false; | ||
77 | bool remote_button_hold(void) { | ||
78 | return remote_hold_button_state; | ||
79 | } | ||
80 | #endif | ||
81 | |||
82 | void button_event(int key, bool pressed) | ||
83 | { | ||
84 | int new_btn = 0; | ||
85 | static bool usb_connected = false; | ||
86 | if (usb_connected && key != USB_KEY) | ||
87 | return; | ||
88 | switch (key) | ||
89 | { | ||
90 | |||
91 | #ifdef HAVE_TOUCHSCREEN | ||
92 | case BUTTON_TOUCHSCREEN: | ||
93 | switch (touchscreen_get_mode()) | ||
94 | { | ||
95 | case TOUCHSCREEN_POINT: | ||
96 | new_btn = BUTTON_TOUCHSCREEN; | ||
97 | break; | ||
98 | case TOUCHSCREEN_BUTTON: | ||
99 | { | ||
100 | static int touchscreen_buttons[3][3] = { | ||
101 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, | ||
102 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, | ||
103 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, | ||
104 | }; | ||
105 | int px_x = ((mouse_coords&0xffff0000)>>16); | ||
106 | int px_y = ((mouse_coords&0x0000ffff)); | ||
107 | new_btn = touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; | ||
108 | break; | ||
109 | } | ||
110 | } | ||
111 | break; | ||
112 | case SDLK_KP7: | ||
113 | case SDLK_7: | ||
114 | new_btn = BUTTON_TOPLEFT; | ||
115 | break; | ||
116 | case SDLK_KP8: | ||
117 | case SDLK_8: | ||
118 | case SDLK_UP: | ||
119 | new_btn = BUTTON_TOPMIDDLE; | ||
120 | break; | ||
121 | case SDLK_KP9: | ||
122 | case SDLK_9: | ||
123 | new_btn = BUTTON_TOPRIGHT; | ||
124 | break; | ||
125 | case SDLK_KP4: | ||
126 | case SDLK_u: | ||
127 | case SDLK_LEFT: | ||
128 | new_btn = BUTTON_MIDLEFT; | ||
129 | break; | ||
130 | case SDLK_KP5: | ||
131 | case SDLK_i: | ||
132 | new_btn = BUTTON_CENTER; | ||
133 | break; | ||
134 | case SDLK_KP6: | ||
135 | case SDLK_o: | ||
136 | case SDLK_RIGHT: | ||
137 | new_btn = BUTTON_MIDRIGHT; | ||
138 | break; | ||
139 | case SDLK_KP1: | ||
140 | case SDLK_j: | ||
141 | new_btn = BUTTON_BOTTOMLEFT; | ||
142 | break; | ||
143 | case SDLK_KP2: | ||
144 | case SDLK_k: | ||
145 | case SDLK_DOWN: | ||
146 | new_btn = BUTTON_BOTTOMMIDDLE; | ||
147 | break; | ||
148 | case SDLK_KP3: | ||
149 | case SDLK_l: | ||
150 | new_btn = BUTTON_BOTTOMRIGHT; | ||
151 | break; | ||
152 | case SDLK_F4: | ||
153 | if(pressed) | ||
154 | { | ||
155 | touchscreen_set_mode(touchscreen_get_mode() == TOUCHSCREEN_POINT ? TOUCHSCREEN_BUTTON : TOUCHSCREEN_POINT); | ||
156 | printf("Touchscreen mode: %s\n", touchscreen_get_mode() == TOUCHSCREEN_POINT ? "TOUCHSCREEN_POINT" : "TOUCHSCREEN_BUTTON"); | ||
157 | } | ||
158 | break; | ||
159 | |||
160 | #endif | ||
161 | case USB_KEY: | ||
162 | if (!pressed) | ||
163 | { | ||
164 | usb_connected = !usb_connected; | ||
165 | if (usb_connected) | ||
166 | queue_post(&button_queue, SYS_USB_CONNECTED, 0); | ||
167 | else | ||
168 | queue_post(&button_queue, SYS_USB_DISCONNECTED, 0); | ||
169 | } | ||
170 | return; | ||
171 | |||
172 | #ifdef HAS_BUTTON_HOLD | ||
173 | case SDLK_h: | ||
174 | if(pressed) | ||
175 | { | ||
176 | hold_button_state = !hold_button_state; | ||
177 | DEBUGF("Hold button is %s\n", hold_button_state?"ON":"OFF"); | ||
178 | } | ||
179 | return; | ||
180 | #endif | ||
181 | |||
182 | #ifdef HAS_REMOTE_BUTTON_HOLD | ||
183 | case SDLK_j: | ||
184 | if(pressed) | ||
185 | { | ||
186 | remote_hold_button_state = !remote_hold_button_state; | ||
187 | DEBUGF("Remote hold button is %s\n", | ||
188 | remote_hold_button_state?"ON":"OFF"); | ||
189 | } | ||
190 | return; | ||
191 | #endif | ||
192 | |||
193 | #if CONFIG_KEYPAD == GIGABEAT_PAD | ||
194 | case SDLK_KP4: | ||
195 | case SDLK_LEFT: | ||
196 | new_btn = BUTTON_LEFT; | ||
197 | break; | ||
198 | case SDLK_KP6: | ||
199 | case SDLK_RIGHT: | ||
200 | new_btn = BUTTON_RIGHT; | ||
201 | break; | ||
202 | case SDLK_KP8: | ||
203 | case SDLK_UP: | ||
204 | new_btn = BUTTON_UP; | ||
205 | break; | ||
206 | case SDLK_KP2: | ||
207 | case SDLK_DOWN: | ||
208 | new_btn = BUTTON_DOWN; | ||
209 | break; | ||
210 | case SDLK_KP_PLUS: | ||
211 | case SDLK_F8: | ||
212 | new_btn = BUTTON_POWER; | ||
213 | break; | ||
214 | case SDLK_ESCAPE: | ||
215 | new_btn = BUTTON_POWER; | ||
216 | break; | ||
217 | case SDLK_KP_ENTER: | ||
218 | case SDLK_RETURN: | ||
219 | case SDLK_a: | ||
220 | new_btn = BUTTON_A; | ||
221 | break; | ||
222 | case SDLK_KP5: | ||
223 | case SDLK_SPACE: | ||
224 | new_btn = BUTTON_SELECT; | ||
225 | break; | ||
226 | case SDLK_KP_PERIOD: | ||
227 | case SDLK_INSERT: | ||
228 | new_btn = BUTTON_MENU; | ||
229 | break; | ||
230 | case SDLK_KP9: | ||
231 | new_btn = BUTTON_VOL_UP; | ||
232 | break; | ||
233 | case SDLK_KP3: | ||
234 | new_btn = BUTTON_VOL_DOWN; | ||
235 | break; | ||
236 | |||
237 | #elif CONFIG_KEYPAD == GIGABEAT_S_PAD | ||
238 | case SDLK_KP4: | ||
239 | case SDLK_LEFT: | ||
240 | new_btn = BUTTON_LEFT; | ||
241 | break; | ||
242 | case SDLK_KP6: | ||
243 | case SDLK_RIGHT: | ||
244 | new_btn = BUTTON_RIGHT; | ||
245 | break; | ||
246 | case SDLK_KP8: | ||
247 | case SDLK_UP: | ||
248 | new_btn = BUTTON_UP; | ||
249 | break; | ||
250 | case SDLK_KP2: | ||
251 | case SDLK_DOWN: | ||
252 | new_btn = BUTTON_DOWN; | ||
253 | break; | ||
254 | case SDLK_F8: | ||
255 | case SDLK_ESCAPE: | ||
256 | new_btn = BUTTON_POWER; | ||
257 | break; | ||
258 | case SDLK_KP_PLUS: | ||
259 | case SDLK_KP_ENTER: | ||
260 | case SDLK_RETURN: | ||
261 | new_btn = BUTTON_PLAY; | ||
262 | break; | ||
263 | case SDLK_KP7: | ||
264 | new_btn = BUTTON_BACK; | ||
265 | break; | ||
266 | case SDLK_KP5: | ||
267 | case SDLK_SPACE: | ||
268 | new_btn = BUTTON_SELECT; | ||
269 | break; | ||
270 | case SDLK_KP9: | ||
271 | case SDLK_KP_PERIOD: | ||
272 | case SDLK_INSERT: | ||
273 | new_btn = BUTTON_MENU; | ||
274 | break; | ||
275 | |||
276 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD | ||
277 | case SDLK_KP4: | ||
278 | case SDLK_LEFT: | ||
279 | new_btn = BUTTON_LEFT; | ||
280 | break; | ||
281 | case SDLK_KP6: | ||
282 | case SDLK_RIGHT: | ||
283 | new_btn = BUTTON_RIGHT; | ||
284 | break; | ||
285 | case SDLK_KP8: | ||
286 | case SDLK_UP: | ||
287 | new_btn = BUTTON_UP; | ||
288 | break; | ||
289 | case SDLK_KP2: | ||
290 | case SDLK_DOWN: | ||
291 | new_btn = BUTTON_DOWN; | ||
292 | break; | ||
293 | case SDLK_KP_PLUS: | ||
294 | case SDLK_F8: | ||
295 | new_btn = BUTTON_PLAY; | ||
296 | break; | ||
297 | case SDLK_ESCAPE: | ||
298 | new_btn = BUTTON_POWER; | ||
299 | break; | ||
300 | case SDLK_KP_ENTER: | ||
301 | case SDLK_RETURN: | ||
302 | case SDLK_a: | ||
303 | new_btn = BUTTON_POWER; | ||
304 | break; | ||
305 | case SDLK_KP_DIVIDE: | ||
306 | case SDLK_F1: | ||
307 | new_btn = BUTTON_REC; | ||
308 | break; | ||
309 | case SDLK_KP5: | ||
310 | case SDLK_SPACE: | ||
311 | new_btn = BUTTON_SELECT; | ||
312 | break; | ||
313 | |||
314 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD | ||
315 | case SDLK_KP4: | ||
316 | new_btn = BUTTON_LEFT; | ||
317 | break; | ||
318 | case SDLK_LEFT: | ||
319 | new_btn = BUTTON_RC_REW; | ||
320 | break; | ||
321 | case SDLK_KP6: | ||
322 | new_btn = BUTTON_RIGHT; | ||
323 | break; | ||
324 | case SDLK_RIGHT: | ||
325 | new_btn = BUTTON_RC_FF; | ||
326 | break; | ||
327 | case SDLK_KP8: | ||
328 | new_btn = BUTTON_VOL_UP; | ||
329 | break; | ||
330 | case SDLK_UP: | ||
331 | new_btn = BUTTON_RC_VOL_UP; | ||
332 | break; | ||
333 | case SDLK_KP2: | ||
334 | new_btn = BUTTON_VOL_DOWN; | ||
335 | break; | ||
336 | case SDLK_DOWN: | ||
337 | new_btn = BUTTON_RC_VOL_DOWN; | ||
338 | break; | ||
339 | case SDLK_KP_PERIOD: | ||
340 | new_btn = BUTTON_MODE; | ||
341 | break; | ||
342 | case SDLK_INSERT: | ||
343 | new_btn = BUTTON_RC_MODE; | ||
344 | break; | ||
345 | case SDLK_KP_DIVIDE: | ||
346 | new_btn = BUTTON_REC; | ||
347 | break; | ||
348 | case SDLK_F1: | ||
349 | new_btn = BUTTON_RC_REC; | ||
350 | break; | ||
351 | case SDLK_KP5: | ||
352 | new_btn = BUTTON_PLAY; | ||
353 | break; | ||
354 | case SDLK_SPACE: | ||
355 | new_btn = BUTTON_RC_PLAY; | ||
356 | break; | ||
357 | case SDLK_KP_ENTER: | ||
358 | case SDLK_RETURN: | ||
359 | new_btn = BUTTON_RC_MENU; | ||
360 | break; | ||
361 | |||
362 | #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ | ||
363 | || (CONFIG_KEYPAD == IPOD_4G_PAD) | ||
364 | case SDLK_KP4: | ||
365 | case SDLK_LEFT: | ||
366 | new_btn = BUTTON_LEFT; | ||
367 | break; | ||
368 | case SDLK_KP6: | ||
369 | case SDLK_RIGHT: | ||
370 | new_btn = BUTTON_RIGHT; | ||
371 | break; | ||
372 | case SDLK_KP8: | ||
373 | case SDLK_UP: | ||
374 | new_btn = BUTTON_SCROLL_BACK; | ||
375 | break; | ||
376 | case SDLK_KP2: | ||
377 | case SDLK_DOWN: | ||
378 | new_btn = BUTTON_SCROLL_FWD; | ||
379 | break; | ||
380 | case SDLK_KP_PLUS: | ||
381 | case SDLK_F8: | ||
382 | new_btn = BUTTON_PLAY; | ||
383 | break; | ||
384 | case SDLK_KP5: | ||
385 | case SDLK_SPACE: | ||
386 | new_btn = BUTTON_SELECT; | ||
387 | break; | ||
388 | case SDLK_KP_PERIOD: | ||
389 | case SDLK_INSERT: | ||
390 | new_btn = BUTTON_MENU; | ||
391 | break; | ||
392 | |||
393 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD | ||
394 | case SDLK_KP4: | ||
395 | case SDLK_LEFT: | ||
396 | new_btn = BUTTON_LEFT; | ||
397 | break; | ||
398 | case SDLK_KP6: | ||
399 | case SDLK_RIGHT: | ||
400 | new_btn = BUTTON_RIGHT; | ||
401 | break; | ||
402 | case SDLK_KP8: | ||
403 | case SDLK_UP: | ||
404 | new_btn = BUTTON_SCROLL_UP; | ||
405 | break; | ||
406 | case SDLK_KP2: | ||
407 | case SDLK_DOWN: | ||
408 | new_btn = BUTTON_SCROLL_DOWN; | ||
409 | break; | ||
410 | case SDLK_KP_PLUS: | ||
411 | case SDLK_F8: | ||
412 | new_btn = BUTTON_POWER; | ||
413 | break; | ||
414 | case SDLK_ESCAPE: | ||
415 | new_btn = BUTTON_POWER; | ||
416 | break; | ||
417 | case SDLK_KP_DIVIDE: | ||
418 | case SDLK_F1: | ||
419 | new_btn = BUTTON_REW; | ||
420 | break; | ||
421 | case SDLK_KP_MULTIPLY: | ||
422 | case SDLK_F2: | ||
423 | new_btn = BUTTON_FF; | ||
424 | break; | ||
425 | case SDLK_KP5: | ||
426 | case SDLK_SPACE: | ||
427 | new_btn = BUTTON_PLAY; | ||
428 | break; | ||
429 | |||
430 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
431 | case SDLK_t: | ||
432 | if(pressed) | ||
433 | switch(_remote_type) | ||
434 | { | ||
435 | case REMOTETYPE_UNPLUGGED: | ||
436 | _remote_type=REMOTETYPE_H100_LCD; | ||
437 | DEBUGF("Changed remote type to H100\n"); | ||
438 | break; | ||
439 | case REMOTETYPE_H100_LCD: | ||
440 | _remote_type=REMOTETYPE_H300_LCD; | ||
441 | DEBUGF("Changed remote type to H300\n"); | ||
442 | break; | ||
443 | case REMOTETYPE_H300_LCD: | ||
444 | _remote_type=REMOTETYPE_H300_NONLCD; | ||
445 | DEBUGF("Changed remote type to H300 NON-LCD\n"); | ||
446 | break; | ||
447 | case REMOTETYPE_H300_NONLCD: | ||
448 | _remote_type=REMOTETYPE_UNPLUGGED; | ||
449 | DEBUGF("Changed remote type to none\n"); | ||
450 | break; | ||
451 | } | ||
452 | break; | ||
453 | case SDLK_KP4: | ||
454 | case SDLK_LEFT: | ||
455 | new_btn = BUTTON_LEFT; | ||
456 | break; | ||
457 | case SDLK_KP6: | ||
458 | case SDLK_RIGHT: | ||
459 | new_btn = BUTTON_RIGHT; | ||
460 | break; | ||
461 | case SDLK_KP8: | ||
462 | case SDLK_UP: | ||
463 | new_btn = BUTTON_UP; | ||
464 | break; | ||
465 | case SDLK_KP2: | ||
466 | case SDLK_DOWN: | ||
467 | new_btn = BUTTON_DOWN; | ||
468 | break; | ||
469 | case SDLK_KP_PLUS: | ||
470 | case SDLK_F8: | ||
471 | new_btn = BUTTON_ON; | ||
472 | break; | ||
473 | case SDLK_KP_ENTER: | ||
474 | case SDLK_RETURN: | ||
475 | case SDLK_a: | ||
476 | new_btn = BUTTON_OFF; | ||
477 | break; | ||
478 | case SDLK_KP_DIVIDE: | ||
479 | case SDLK_F1: | ||
480 | new_btn = BUTTON_REC; | ||
481 | break; | ||
482 | case SDLK_KP5: | ||
483 | case SDLK_SPACE: | ||
484 | new_btn = BUTTON_SELECT; | ||
485 | break; | ||
486 | case SDLK_KP_PERIOD: | ||
487 | case SDLK_INSERT: | ||
488 | new_btn = BUTTON_MODE; | ||
489 | break; | ||
490 | |||
491 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD | ||
492 | case SDLK_KP4: | ||
493 | case SDLK_LEFT: | ||
494 | new_btn = BUTTON_LEFT; | ||
495 | break; | ||
496 | case SDLK_KP6: | ||
497 | case SDLK_RIGHT: | ||
498 | new_btn = BUTTON_RIGHT; | ||
499 | break; | ||
500 | case SDLK_KP8: | ||
501 | case SDLK_UP: | ||
502 | new_btn = BUTTON_UP; | ||
503 | break; | ||
504 | case SDLK_KP2: | ||
505 | case SDLK_DOWN: | ||
506 | new_btn = BUTTON_DOWN; | ||
507 | break; | ||
508 | case SDLK_KP_PLUS: | ||
509 | case SDLK_F8: | ||
510 | new_btn = BUTTON_PLAY; | ||
511 | break; | ||
512 | case SDLK_KP_ENTER: | ||
513 | case SDLK_RETURN: | ||
514 | case SDLK_a: | ||
515 | new_btn = BUTTON_EQ; | ||
516 | break; | ||
517 | case SDLK_KP5: | ||
518 | case SDLK_SPACE: | ||
519 | new_btn = BUTTON_SELECT; | ||
520 | break; | ||
521 | case SDLK_KP_PERIOD: | ||
522 | case SDLK_INSERT: | ||
523 | new_btn = BUTTON_MODE; | ||
524 | break; | ||
525 | |||
526 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
527 | case SDLK_KP4: | ||
528 | case SDLK_LEFT: | ||
529 | new_btn = BUTTON_LEFT; | ||
530 | break; | ||
531 | case SDLK_KP6: | ||
532 | case SDLK_RIGHT: | ||
533 | new_btn = BUTTON_RIGHT; | ||
534 | break; | ||
535 | case SDLK_KP8: | ||
536 | case SDLK_UP: | ||
537 | new_btn = BUTTON_UP; | ||
538 | break; | ||
539 | case SDLK_KP2: | ||
540 | case SDLK_DOWN: | ||
541 | new_btn = BUTTON_DOWN; | ||
542 | break; | ||
543 | case SDLK_KP_ENTER: | ||
544 | case SDLK_RETURN: | ||
545 | case SDLK_a: | ||
546 | new_btn = BUTTON_OFF; | ||
547 | break; | ||
548 | case SDLK_KP_PERIOD: | ||
549 | case SDLK_INSERT: | ||
550 | new_btn = BUTTON_MENU; | ||
551 | break; | ||
552 | |||
553 | #elif CONFIG_KEYPAD == PLAYER_PAD | ||
554 | case SDLK_KP4: | ||
555 | case SDLK_LEFT: | ||
556 | new_btn = BUTTON_LEFT; | ||
557 | break; | ||
558 | case SDLK_KP6: | ||
559 | case SDLK_RIGHT: | ||
560 | new_btn = BUTTON_RIGHT; | ||
561 | break; | ||
562 | case SDLK_KP8: | ||
563 | case SDLK_UP: | ||
564 | new_btn = BUTTON_PLAY; | ||
565 | break; | ||
566 | case SDLK_KP2: | ||
567 | case SDLK_DOWN: | ||
568 | new_btn = BUTTON_STOP; | ||
569 | break; | ||
570 | case SDLK_KP_PLUS: | ||
571 | case SDLK_F8: | ||
572 | new_btn = BUTTON_ON; | ||
573 | break; | ||
574 | case SDLK_KP_PERIOD: | ||
575 | case SDLK_INSERT: | ||
576 | new_btn = BUTTON_MENU; | ||
577 | break; | ||
578 | |||
579 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
580 | case SDLK_KP4: | ||
581 | case SDLK_LEFT: | ||
582 | new_btn = BUTTON_LEFT; | ||
583 | break; | ||
584 | case SDLK_KP6: | ||
585 | case SDLK_RIGHT: | ||
586 | new_btn = BUTTON_RIGHT; | ||
587 | break; | ||
588 | case SDLK_KP8: | ||
589 | case SDLK_UP: | ||
590 | new_btn = BUTTON_UP; | ||
591 | break; | ||
592 | case SDLK_KP2: | ||
593 | case SDLK_DOWN: | ||
594 | new_btn = BUTTON_DOWN; | ||
595 | break; | ||
596 | case SDLK_KP_PLUS: | ||
597 | case SDLK_F8: | ||
598 | new_btn = BUTTON_ON; | ||
599 | break; | ||
600 | case SDLK_KP_ENTER: | ||
601 | case SDLK_RETURN: | ||
602 | case SDLK_a: | ||
603 | new_btn = BUTTON_OFF; | ||
604 | break; | ||
605 | case SDLK_KP_DIVIDE: | ||
606 | case SDLK_F1: | ||
607 | new_btn = BUTTON_F1; | ||
608 | break; | ||
609 | case SDLK_KP_MULTIPLY: | ||
610 | case SDLK_F2: | ||
611 | new_btn = BUTTON_F2; | ||
612 | break; | ||
613 | case SDLK_KP_MINUS: | ||
614 | case SDLK_F3: | ||
615 | new_btn = BUTTON_F3; | ||
616 | break; | ||
617 | case SDLK_KP5: | ||
618 | case SDLK_SPACE: | ||
619 | new_btn = BUTTON_PLAY; | ||
620 | break; | ||
621 | |||
622 | #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD | ||
623 | case SDLK_KP4: | ||
624 | case SDLK_LEFT: | ||
625 | new_btn = BUTTON_LEFT; | ||
626 | break; | ||
627 | case SDLK_KP6: | ||
628 | case SDLK_RIGHT: | ||
629 | new_btn = BUTTON_RIGHT; | ||
630 | break; | ||
631 | case SDLK_KP8: | ||
632 | case SDLK_UP: | ||
633 | new_btn = BUTTON_UP; | ||
634 | break; | ||
635 | case SDLK_KP2: | ||
636 | case SDLK_DOWN: | ||
637 | new_btn = BUTTON_DOWN; | ||
638 | break; | ||
639 | case SDLK_KP_PLUS: | ||
640 | case SDLK_F8: | ||
641 | new_btn = BUTTON_ON; | ||
642 | break; | ||
643 | case SDLK_KP_ENTER: | ||
644 | case SDLK_RETURN: | ||
645 | case SDLK_a: | ||
646 | new_btn = BUTTON_OFF; | ||
647 | break; | ||
648 | case SDLK_KP_DIVIDE: | ||
649 | case SDLK_F1: | ||
650 | new_btn = BUTTON_F1; | ||
651 | break; | ||
652 | case SDLK_KP_MULTIPLY: | ||
653 | case SDLK_F2: | ||
654 | new_btn = BUTTON_F2; | ||
655 | break; | ||
656 | case SDLK_KP_MINUS: | ||
657 | case SDLK_F3: | ||
658 | new_btn = BUTTON_F3; | ||
659 | break; | ||
660 | case SDLK_KP5: | ||
661 | case SDLK_SPACE: | ||
662 | new_btn = BUTTON_SELECT; | ||
663 | break; | ||
664 | |||
665 | #elif CONFIG_KEYPAD == SANSA_E200_PAD | ||
666 | case SDLK_KP4: | ||
667 | case SDLK_LEFT: | ||
668 | new_btn = BUTTON_LEFT; | ||
669 | break; | ||
670 | case SDLK_KP6: | ||
671 | case SDLK_RIGHT: | ||
672 | new_btn = BUTTON_RIGHT; | ||
673 | break; | ||
674 | case SDLK_KP8: | ||
675 | case SDLK_UP: | ||
676 | new_btn = BUTTON_SCROLL_BACK; | ||
677 | break; | ||
678 | case SDLK_KP2: | ||
679 | case SDLK_DOWN: | ||
680 | new_btn = BUTTON_SCROLL_FWD; | ||
681 | break; | ||
682 | case SDLK_KP9: | ||
683 | case SDLK_PAGEUP: | ||
684 | new_btn = BUTTON_UP; | ||
685 | break; | ||
686 | case SDLK_KP3: | ||
687 | case SDLK_PAGEDOWN: | ||
688 | new_btn = BUTTON_DOWN; | ||
689 | break; | ||
690 | case SDLK_KP1: | ||
691 | case SDLK_HOME: | ||
692 | new_btn = BUTTON_POWER; | ||
693 | break; | ||
694 | case SDLK_KP7: | ||
695 | case SDLK_END: | ||
696 | new_btn = BUTTON_REC; | ||
697 | break; | ||
698 | case SDLK_KP5: | ||
699 | case SDLK_SPACE: | ||
700 | new_btn = BUTTON_SELECT; | ||
701 | break; | ||
702 | |||
703 | #elif CONFIG_KEYPAD == SANSA_C200_PAD | ||
704 | case SDLK_KP4: | ||
705 | case SDLK_LEFT: | ||
706 | new_btn = BUTTON_LEFT; | ||
707 | break; | ||
708 | case SDLK_KP6: | ||
709 | case SDLK_RIGHT: | ||
710 | new_btn = BUTTON_RIGHT; | ||
711 | break; | ||
712 | case SDLK_KP8: | ||
713 | case SDLK_UP: | ||
714 | new_btn = BUTTON_UP; | ||
715 | break; | ||
716 | case SDLK_KP2: | ||
717 | case SDLK_DOWN: | ||
718 | new_btn = BUTTON_DOWN; | ||
719 | break; | ||
720 | case SDLK_KP3: | ||
721 | new_btn = BUTTON_POWER; | ||
722 | break; | ||
723 | case SDLK_KP1: | ||
724 | new_btn = BUTTON_REC; | ||
725 | break; | ||
726 | case SDLK_KP5: | ||
727 | case SDLK_KP_ENTER: | ||
728 | case SDLK_RETURN: | ||
729 | new_btn = BUTTON_SELECT; | ||
730 | break; | ||
731 | case SDLK_KP7: | ||
732 | new_btn = BUTTON_VOL_DOWN; | ||
733 | break; | ||
734 | case SDLK_KP9: | ||
735 | new_btn = BUTTON_VOL_UP; | ||
736 | break; | ||
737 | |||
738 | #elif CONFIG_KEYPAD == MROBE500_PAD | ||
739 | case SDLK_F9: | ||
740 | new_btn = BUTTON_RC_HEART; | ||
741 | break; | ||
742 | case SDLK_F10: | ||
743 | new_btn = BUTTON_RC_MODE; | ||
744 | break; | ||
745 | case SDLK_F11: | ||
746 | new_btn = BUTTON_RC_VOL_DOWN; | ||
747 | break; | ||
748 | case SDLK_F12: | ||
749 | new_btn = BUTTON_RC_VOL_UP; | ||
750 | break; | ||
751 | case SDLK_MINUS: | ||
752 | case SDLK_LESS: | ||
753 | case SDLK_LEFTBRACKET: | ||
754 | case SDLK_KP_DIVIDE: | ||
755 | new_btn = BUTTON_LEFT; | ||
756 | break; | ||
757 | case SDLK_PLUS: | ||
758 | case SDLK_GREATER: | ||
759 | case SDLK_RIGHTBRACKET: | ||
760 | case SDLK_KP_MULTIPLY: | ||
761 | new_btn = BUTTON_RIGHT; | ||
762 | break; | ||
763 | case SDLK_PAGEUP: | ||
764 | new_btn = BUTTON_RC_PLAY; | ||
765 | break; | ||
766 | case SDLK_PAGEDOWN: | ||
767 | new_btn = BUTTON_RC_DOWN; | ||
768 | break; | ||
769 | case SDLK_F8: | ||
770 | case SDLK_ESCAPE: | ||
771 | new_btn = BUTTON_POWER; | ||
772 | break; | ||
773 | #elif CONFIG_KEYPAD == MROBE100_PAD | ||
774 | case SDLK_F9: | ||
775 | new_btn = BUTTON_RC_HEART; | ||
776 | break; | ||
777 | case SDLK_F10: | ||
778 | new_btn = BUTTON_RC_MODE; | ||
779 | break; | ||
780 | case SDLK_F11: | ||
781 | new_btn = BUTTON_RC_VOL_DOWN; | ||
782 | break; | ||
783 | case SDLK_F12: | ||
784 | new_btn = BUTTON_RC_VOL_UP; | ||
785 | break; | ||
786 | case SDLK_LEFT: | ||
787 | new_btn = BUTTON_RC_FF; | ||
788 | break; | ||
789 | case SDLK_RIGHT: | ||
790 | new_btn = BUTTON_RC_REW; | ||
791 | break; | ||
792 | case SDLK_UP: | ||
793 | new_btn = BUTTON_RC_PLAY; | ||
794 | break; | ||
795 | case SDLK_DOWN: | ||
796 | new_btn = BUTTON_RC_DOWN; | ||
797 | break; | ||
798 | case SDLK_KP1: | ||
799 | new_btn = BUTTON_DISPLAY; | ||
800 | break; | ||
801 | case SDLK_KP7: | ||
802 | new_btn = BUTTON_MENU; | ||
803 | break; | ||
804 | case SDLK_KP9: | ||
805 | new_btn = BUTTON_PLAY; | ||
806 | break; | ||
807 | case SDLK_KP4: | ||
808 | new_btn = BUTTON_LEFT; | ||
809 | break; | ||
810 | case SDLK_KP6: | ||
811 | new_btn = BUTTON_RIGHT; | ||
812 | break; | ||
813 | case SDLK_KP8: | ||
814 | new_btn = BUTTON_UP; | ||
815 | break; | ||
816 | case SDLK_KP2: | ||
817 | new_btn = BUTTON_DOWN; | ||
818 | break; | ||
819 | case SDLK_KP5: | ||
820 | case SDLK_SPACE: | ||
821 | new_btn = BUTTON_SELECT; | ||
822 | break; | ||
823 | case SDLK_KP_MULTIPLY: | ||
824 | case SDLK_F8: | ||
825 | case SDLK_ESCAPE: | ||
826 | new_btn = BUTTON_POWER; | ||
827 | break; | ||
828 | |||
829 | #elif CONFIG_KEYPAD == COWON_D2_PAD | ||
830 | case SDLK_KP_MULTIPLY: | ||
831 | case SDLK_F8: | ||
832 | case SDLK_ESCAPE: | ||
833 | case SDLK_BACKSPACE: | ||
834 | case SDLK_DELETE: | ||
835 | new_btn = BUTTON_POWER; | ||
836 | break; | ||
837 | case SDLK_KP_PLUS: | ||
838 | case SDLK_EQUALS: | ||
839 | new_btn = BUTTON_PLUS; | ||
840 | break; | ||
841 | case SDLK_KP_MINUS: | ||
842 | case SDLK_MINUS: | ||
843 | new_btn = BUTTON_MINUS; | ||
844 | break; | ||
845 | case SDLK_KP_ENTER: | ||
846 | case SDLK_RETURN: | ||
847 | case SDLK_SPACE: | ||
848 | case SDLK_INSERT: | ||
849 | new_btn = BUTTON_MENU; | ||
850 | break; | ||
851 | #elif CONFIG_KEYPAD == IAUDIO67_PAD | ||
852 | case SDLK_UP: | ||
853 | new_btn = BUTTON_RIGHT; | ||
854 | break; | ||
855 | case SDLK_DOWN: | ||
856 | new_btn = BUTTON_LEFT; | ||
857 | break; | ||
858 | case SDLK_LEFT: | ||
859 | new_btn = BUTTON_STOP; | ||
860 | break; | ||
861 | case SDLK_RETURN: | ||
862 | case SDLK_KP_ENTER: | ||
863 | case SDLK_RIGHT: | ||
864 | new_btn = BUTTON_PLAY; | ||
865 | break; | ||
866 | case SDLK_PLUS: | ||
867 | new_btn = BUTTON_VOLUP; | ||
868 | break; | ||
869 | case SDLK_MINUS: | ||
870 | new_btn = BUTTON_VOLDOWN; | ||
871 | break; | ||
872 | case SDLK_SPACE: | ||
873 | new_btn = BUTTON_MENU; | ||
874 | break; | ||
875 | case SDLK_BACKSPACE: | ||
876 | new_btn = BUTTON_POWER; | ||
877 | break; | ||
878 | #elif CONFIG_KEYPAD == CREATIVEZVM_PAD | ||
879 | case SDLK_KP1: | ||
880 | new_btn = BUTTON_BACK; | ||
881 | break; | ||
882 | case SDLK_KP3: | ||
883 | new_btn = BUTTON_MENU; | ||
884 | break; | ||
885 | case SDLK_KP7: | ||
886 | new_btn = BUTTON_CUSTOM; | ||
887 | break; | ||
888 | case SDLK_KP9: | ||
889 | new_btn = BUTTON_PLAY; | ||
890 | break; | ||
891 | case SDLK_KP4: | ||
892 | case SDLK_LEFT: | ||
893 | new_btn = BUTTON_LEFT; | ||
894 | break; | ||
895 | case SDLK_KP6: | ||
896 | case SDLK_RIGHT: | ||
897 | new_btn = BUTTON_RIGHT; | ||
898 | break; | ||
899 | case SDLK_KP8: | ||
900 | case SDLK_UP: | ||
901 | new_btn = BUTTON_UP; | ||
902 | break; | ||
903 | case SDLK_KP2: | ||
904 | case SDLK_DOWN: | ||
905 | new_btn = BUTTON_DOWN; | ||
906 | break; | ||
907 | case SDLK_KP5: | ||
908 | case SDLK_SPACE: | ||
909 | new_btn = BUTTON_SELECT; | ||
910 | break; | ||
911 | case SDLK_KP_MULTIPLY: | ||
912 | case SDLK_F8: | ||
913 | case SDLK_ESCAPE: | ||
914 | new_btn = BUTTON_POWER; | ||
915 | break; | ||
916 | #elif CONFIG_KEYPAD == CREATIVEZV_PAD | ||
917 | case SDLK_KP1: | ||
918 | new_btn = BUTTON_PREV; | ||
919 | break; | ||
920 | case SDLK_KP3: | ||
921 | new_btn = BUTTON_NEXT; | ||
922 | break; | ||
923 | case SDLK_KP7: | ||
924 | new_btn = BUTTON_BACK; | ||
925 | break; | ||
926 | case SDLK_p: | ||
927 | new_btn = BUTTON_PLAY; | ||
928 | break; | ||
929 | case SDLK_KP9: | ||
930 | new_btn = BUTTON_MENU; | ||
931 | break; | ||
932 | case SDLK_KP4: | ||
933 | case SDLK_LEFT: | ||
934 | new_btn = BUTTON_LEFT; | ||
935 | break; | ||
936 | case SDLK_KP6: | ||
937 | case SDLK_RIGHT: | ||
938 | new_btn = BUTTON_RIGHT; | ||
939 | break; | ||
940 | case SDLK_KP8: | ||
941 | case SDLK_UP: | ||
942 | new_btn = BUTTON_UP; | ||
943 | break; | ||
944 | case SDLK_KP2: | ||
945 | case SDLK_DOWN: | ||
946 | new_btn = BUTTON_DOWN; | ||
947 | break; | ||
948 | case SDLK_KP5: | ||
949 | case SDLK_SPACE: | ||
950 | new_btn = BUTTON_SELECT; | ||
951 | break; | ||
952 | case SDLK_KP_MULTIPLY: | ||
953 | case SDLK_F8: | ||
954 | case SDLK_ESCAPE: | ||
955 | new_btn = BUTTON_POWER; | ||
956 | break; | ||
957 | case SDLK_z: | ||
958 | new_btn = BUTTON_VOL_DOWN; | ||
959 | break; | ||
960 | case SDLK_s: | ||
961 | new_btn = BUTTON_VOL_UP; | ||
962 | |||
963 | #elif CONFIG_KEYPAD == MEIZU_M6SL_PAD | ||
964 | case SDLK_KP1: | ||
965 | new_btn = BUTTON_PREV; | ||
966 | break; | ||
967 | case SDLK_KP3: | ||
968 | new_btn = BUTTON_NEXT; | ||
969 | break; | ||
970 | case SDLK_KP_ENTER: | ||
971 | case SDLK_RETURN: | ||
972 | case SDLK_a: | ||
973 | new_btn = BUTTON_PLAY; | ||
974 | break; | ||
975 | case SDLK_KP_PERIOD: | ||
976 | case SDLK_INSERT: | ||
977 | new_btn = BUTTON_MENU; | ||
978 | break; | ||
979 | case SDLK_KP8: | ||
980 | case SDLK_UP: | ||
981 | new_btn = BUTTON_UP; | ||
982 | break; | ||
983 | case SDLK_KP2: | ||
984 | case SDLK_DOWN: | ||
985 | new_btn = BUTTON_DOWN; | ||
986 | break; | ||
987 | case SDLK_KP5: | ||
988 | case SDLK_SPACE: | ||
989 | new_btn = BUTTON_SELECT; | ||
990 | break; | ||
991 | #elif CONFIG_KEYPAD == SANSA_FUZE_PAD | ||
992 | case SDLK_KP4: | ||
993 | case SDLK_LEFT: | ||
994 | new_btn = BUTTON_LEFT; | ||
995 | break; | ||
996 | case SDLK_KP6: | ||
997 | case SDLK_RIGHT: | ||
998 | new_btn = BUTTON_RIGHT; | ||
999 | break; | ||
1000 | case SDLK_KP8: | ||
1001 | case SDLK_UP: | ||
1002 | new_btn = BUTTON_SCROLL_BACK; | ||
1003 | break; | ||
1004 | case SDLK_KP2: | ||
1005 | case SDLK_DOWN: | ||
1006 | new_btn = BUTTON_SCROLL_FWD; | ||
1007 | break; | ||
1008 | case SDLK_PAGEUP: | ||
1009 | case SDLK_KP9: | ||
1010 | new_btn = BUTTON_UP; | ||
1011 | break; | ||
1012 | case SDLK_PAGEDOWN: | ||
1013 | case SDLK_KP3: | ||
1014 | new_btn = BUTTON_DOWN; | ||
1015 | break; | ||
1016 | case SDLK_KP_MINUS: | ||
1017 | case SDLK_KP1: | ||
1018 | new_btn = BUTTON_POWER; | ||
1019 | break; | ||
1020 | case SDLK_KP_MULTIPLY: | ||
1021 | new_btn = BUTTON_HOME; | ||
1022 | break; | ||
1023 | case SDLK_KP5: | ||
1024 | case SDLK_SPACE: | ||
1025 | case SDLK_KP_ENTER: | ||
1026 | case SDLK_RETURN: | ||
1027 | new_btn = BUTTON_SELECT; | ||
1028 | break; | ||
1029 | #elif CONFIG_KEYPAD == SANSA_CLIP_PAD | ||
1030 | case SDLK_KP4: | ||
1031 | case SDLK_LEFT: | ||
1032 | new_btn = BUTTON_LEFT; | ||
1033 | break; | ||
1034 | case SDLK_KP6: | ||
1035 | case SDLK_RIGHT: | ||
1036 | new_btn = BUTTON_RIGHT; | ||
1037 | break; | ||
1038 | case SDLK_KP8: | ||
1039 | case SDLK_UP: | ||
1040 | new_btn = BUTTON_UP; | ||
1041 | break; | ||
1042 | case SDLK_KP2: | ||
1043 | case SDLK_DOWN: | ||
1044 | new_btn = BUTTON_DOWN; | ||
1045 | break; | ||
1046 | |||
1047 | case SDLK_INSERT: | ||
1048 | case SDLK_KP_MULTIPLY: | ||
1049 | new_btn = BUTTON_HOME; | ||
1050 | break; | ||
1051 | case SDLK_SPACE: | ||
1052 | case SDLK_KP5: | ||
1053 | new_btn = BUTTON_SELECT; | ||
1054 | break; | ||
1055 | case SDLK_PAGEDOWN: | ||
1056 | case SDLK_KP3: | ||
1057 | new_btn = BUTTON_VOL_DOWN; | ||
1058 | break; | ||
1059 | case SDLK_PAGEUP: | ||
1060 | case SDLK_KP9: | ||
1061 | new_btn = BUTTON_VOL_UP; | ||
1062 | break; | ||
1063 | case SDLK_ESCAPE: | ||
1064 | case SDLK_KP1: | ||
1065 | new_btn = BUTTON_POWER; | ||
1066 | break; | ||
1067 | #elif CONFIG_KEYPAD == SANSA_M200_PAD | ||
1068 | case SDLK_KP4: | ||
1069 | case SDLK_LEFT: | ||
1070 | new_btn = BUTTON_LEFT; | ||
1071 | break; | ||
1072 | case SDLK_KP6: | ||
1073 | case SDLK_RIGHT: | ||
1074 | new_btn = BUTTON_RIGHT; | ||
1075 | break; | ||
1076 | case SDLK_KP8: | ||
1077 | case SDLK_UP: | ||
1078 | new_btn = BUTTON_UP; | ||
1079 | break; | ||
1080 | case SDLK_KP2: | ||
1081 | case SDLK_DOWN: | ||
1082 | new_btn = BUTTON_DOWN; | ||
1083 | break; | ||
1084 | case SDLK_PLUS: | ||
1085 | new_btn = BUTTON_POWER; | ||
1086 | break; | ||
1087 | case SDLK_KP5: | ||
1088 | new_btn = BUTTON_SELECT; | ||
1089 | break; | ||
1090 | case SDLK_KP7: | ||
1091 | new_btn = BUTTON_VOL_DOWN; | ||
1092 | break; | ||
1093 | case SDLK_KP9: | ||
1094 | new_btn = BUTTON_VOL_UP; | ||
1095 | break; | ||
1096 | #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD | ||
1097 | case SDLK_KP4: | ||
1098 | case SDLK_LEFT: | ||
1099 | new_btn = BUTTON_LEFT; | ||
1100 | break; | ||
1101 | case SDLK_KP6: | ||
1102 | case SDLK_RIGHT: | ||
1103 | new_btn = BUTTON_RIGHT; | ||
1104 | break; | ||
1105 | case SDLK_KP8: | ||
1106 | case SDLK_UP: | ||
1107 | new_btn = BUTTON_UP; | ||
1108 | break; | ||
1109 | case SDLK_KP2: | ||
1110 | case SDLK_DOWN: | ||
1111 | new_btn = BUTTON_DOWN; | ||
1112 | break; | ||
1113 | case SDLK_KP1: | ||
1114 | new_btn = BUTTON_MENU; | ||
1115 | break; | ||
1116 | case SDLK_KP5: | ||
1117 | case SDLK_SPACE: | ||
1118 | new_btn = BUTTON_PLAY; | ||
1119 | break; | ||
1120 | case SDLK_KP7: | ||
1121 | new_btn = BUTTON_PREV; | ||
1122 | break; | ||
1123 | case SDLK_KP9: | ||
1124 | new_btn = BUTTON_NEXT; | ||
1125 | break; | ||
1126 | case SDLK_KP_ENTER: | ||
1127 | case SDLK_RETURN: | ||
1128 | new_btn = BUTTON_POWER; | ||
1129 | break; | ||
1130 | case SDLK_PAGEUP: | ||
1131 | new_btn = BUTTON_VOL_UP; | ||
1132 | break; | ||
1133 | case SDLK_PAGEDOWN: | ||
1134 | new_btn = BUTTON_VOL_DOWN; | ||
1135 | break; | ||
1136 | #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD | ||
1137 | case SDLK_KP4: | ||
1138 | case SDLK_LEFT: | ||
1139 | new_btn = BUTTON_LEFT; | ||
1140 | break; | ||
1141 | case SDLK_KP6: | ||
1142 | case SDLK_RIGHT: | ||
1143 | new_btn = BUTTON_RIGHT; | ||
1144 | break; | ||
1145 | case SDLK_KP8: | ||
1146 | case SDLK_UP: | ||
1147 | new_btn = BUTTON_UP; | ||
1148 | break; | ||
1149 | case SDLK_KP2: | ||
1150 | case SDLK_DOWN: | ||
1151 | new_btn = BUTTON_DOWN; | ||
1152 | break; | ||
1153 | case SDLK_KP5: | ||
1154 | case SDLK_SPACE: | ||
1155 | new_btn = BUTTON_SELECT; | ||
1156 | break; | ||
1157 | case SDLK_KP7: | ||
1158 | case SDLK_ESCAPE: | ||
1159 | new_btn = BUTTON_POWER; | ||
1160 | break; | ||
1161 | case SDLK_KP1: | ||
1162 | new_btn = BUTTON_PLAYLIST; | ||
1163 | break; | ||
1164 | case SDLK_KP9: | ||
1165 | new_btn = BUTTON_VOL_UP; | ||
1166 | break; | ||
1167 | case SDLK_KP3: | ||
1168 | new_btn = BUTTON_VOL_DOWN; | ||
1169 | break; | ||
1170 | case SDLK_KP_MINUS: | ||
1171 | new_btn = BUTTON_MENU; | ||
1172 | break; | ||
1173 | case SDLK_KP_PLUS: | ||
1174 | new_btn = BUTTON_VIEW; | ||
1175 | break; | ||
1176 | #elif CONFIG_KEYPAD == ONDAVX747_PAD | ||
1177 | case SDLK_ESCAPE: | ||
1178 | new_btn = BUTTON_POWER; | ||
1179 | break; | ||
1180 | case SDLK_KP_PLUS: | ||
1181 | case SDLK_PLUS: | ||
1182 | case SDLK_GREATER: | ||
1183 | case SDLK_RIGHTBRACKET: | ||
1184 | case SDLK_KP_MULTIPLY: | ||
1185 | new_btn = BUTTON_VOL_UP; | ||
1186 | break; | ||
1187 | case SDLK_KP_MINUS: | ||
1188 | case SDLK_MINUS: | ||
1189 | case SDLK_LESS: | ||
1190 | case SDLK_LEFTBRACKET: | ||
1191 | case SDLK_KP_DIVIDE: | ||
1192 | new_btn = BUTTON_VOL_DOWN; | ||
1193 | break; | ||
1194 | case SDLK_KP_ENTER: | ||
1195 | case SDLK_RETURN: | ||
1196 | new_btn = BUTTON_MENU; | ||
1197 | break; | ||
1198 | #elif CONFIG_KEYPAD == ONDAVX777_PAD | ||
1199 | case SDLK_ESCAPE: | ||
1200 | new_btn = BUTTON_POWER; | ||
1201 | break; | ||
1202 | #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD | ||
1203 | case SDLK_KP4: | ||
1204 | case SDLK_LEFT: | ||
1205 | new_btn = BUTTON_LEFT; | ||
1206 | break; | ||
1207 | case SDLK_KP6: | ||
1208 | case SDLK_RIGHT: | ||
1209 | new_btn = BUTTON_RIGHT; | ||
1210 | break; | ||
1211 | case SDLK_KP8: | ||
1212 | case SDLK_UP: | ||
1213 | new_btn = BUTTON_UP; | ||
1214 | break; | ||
1215 | case SDLK_KP2: | ||
1216 | case SDLK_DOWN: | ||
1217 | new_btn = BUTTON_DOWN; | ||
1218 | break; | ||
1219 | case SDLK_KP5: | ||
1220 | case SDLK_KP_ENTER: | ||
1221 | new_btn = BUTTON_PLAY; | ||
1222 | break; | ||
1223 | case SDLK_KP9: | ||
1224 | case SDLK_PAGEUP: | ||
1225 | new_btn = BUTTON_FFWD; | ||
1226 | break; | ||
1227 | #ifdef SAMSUNG_YH820 | ||
1228 | case SDLK_KP7: | ||
1229 | #else | ||
1230 | case SDLK_KP3: | ||
1231 | #endif | ||
1232 | case SDLK_PAGEDOWN: | ||
1233 | new_btn = BUTTON_REW; | ||
1234 | break; | ||
1235 | case SDLK_KP_PLUS: | ||
1236 | new_btn = BUTTON_REC; | ||
1237 | break; | ||
1238 | #elif CONFIG_KEYPAD == MINI2440_PAD | ||
1239 | case SDLK_LEFT: | ||
1240 | new_btn = BUTTON_LEFT; | ||
1241 | break; | ||
1242 | case SDLK_RIGHT: | ||
1243 | new_btn = BUTTON_RIGHT; | ||
1244 | break; | ||
1245 | case SDLK_UP: | ||
1246 | new_btn = BUTTON_UP; | ||
1247 | break; | ||
1248 | case SDLK_DOWN: | ||
1249 | new_btn = BUTTON_DOWN; | ||
1250 | break; | ||
1251 | case SDLK_F8: | ||
1252 | case SDLK_ESCAPE: | ||
1253 | new_btn = BUTTON_POWER; | ||
1254 | break; | ||
1255 | case SDLK_KP_ENTER: | ||
1256 | case SDLK_RETURN: | ||
1257 | case SDLK_a: | ||
1258 | new_btn = BUTTON_A; | ||
1259 | break; | ||
1260 | case SDLK_SPACE: | ||
1261 | new_btn = BUTTON_SELECT; | ||
1262 | break; | ||
1263 | case SDLK_KP_PERIOD: | ||
1264 | case SDLK_INSERT: | ||
1265 | new_btn = BUTTON_MENU; | ||
1266 | break; | ||
1267 | case SDLK_KP_PLUS: | ||
1268 | new_btn = BUTTON_VOL_UP; | ||
1269 | break; | ||
1270 | case SDLK_KP_MINUS: | ||
1271 | new_btn = BUTTON_VOL_DOWN; | ||
1272 | break; | ||
1273 | #elif CONFIG_KEYPAD == PBELL_VIBE500_PAD | ||
1274 | case SDLK_KP4: | ||
1275 | case SDLK_LEFT: | ||
1276 | new_btn = BUTTON_PREV; | ||
1277 | break; | ||
1278 | case SDLK_KP6: | ||
1279 | case SDLK_RIGHT: | ||
1280 | new_btn = BUTTON_NEXT; | ||
1281 | break; | ||
1282 | case SDLK_KP8: | ||
1283 | case SDLK_UP: | ||
1284 | new_btn = BUTTON_UP; | ||
1285 | break; | ||
1286 | case SDLK_KP2: | ||
1287 | case SDLK_DOWN: | ||
1288 | new_btn = BUTTON_DOWN; | ||
1289 | break; | ||
1290 | case SDLK_KP7: | ||
1291 | new_btn = BUTTON_MENU; | ||
1292 | break; | ||
1293 | case SDLK_KP9: | ||
1294 | new_btn = BUTTON_PLAY; | ||
1295 | break; | ||
1296 | case SDLK_KP5: | ||
1297 | new_btn = BUTTON_OK; | ||
1298 | break; | ||
1299 | case SDLK_KP_DIVIDE: | ||
1300 | new_btn = BUTTON_CANCEL; | ||
1301 | break; | ||
1302 | case SDLK_KP_PLUS: | ||
1303 | new_btn = BUTTON_POWER; | ||
1304 | break; | ||
1305 | case SDLK_KP_MULTIPLY: | ||
1306 | new_btn = BUTTON_REC; | ||
1307 | break; | ||
1308 | |||
1309 | #elif CONFIG_KEYPAD == MPIO_HD200_PAD | ||
1310 | case SDLK_UP: | ||
1311 | new_btn = BUTTON_PREV; | ||
1312 | break; | ||
1313 | case SDLK_DOWN: | ||
1314 | new_btn = BUTTON_NEXT; | ||
1315 | break; | ||
1316 | case SDLK_SPACE: | ||
1317 | new_btn = BUTTON_SELECT; | ||
1318 | break; | ||
1319 | case SDLK_RETURN: | ||
1320 | new_btn = BUTTON_PLAY; | ||
1321 | break; | ||
1322 | case SDLK_LEFT: | ||
1323 | new_btn = BUTTON_VOL_DOWN; | ||
1324 | break; | ||
1325 | case SDLK_RIGHT: | ||
1326 | new_btn = BUTTON_VOL_UP; | ||
1327 | break; | ||
1328 | case SDLK_ESCAPE: | ||
1329 | new_btn = BUTTON_REC; | ||
1330 | break; | ||
1331 | |||
1332 | #else | ||
1333 | #error No keymap defined! | ||
1334 | #endif /* CONFIG_KEYPAD */ | ||
1335 | case SDLK_KP0: | ||
1336 | case SDLK_F5: | ||
1337 | if(pressed) | ||
1338 | { | ||
1339 | sim_trigger_screendump(); | ||
1340 | return; | ||
1341 | } | ||
1342 | break; | ||
1343 | } | ||
1344 | |||
1345 | /* Call to make up for scrollwheel target implementation. This is | ||
1346 | * not handled in the main button.c driver, but on the target | ||
1347 | * implementation (look at button-e200.c for example if you are trying to | ||
1348 | * figure out why using button_get_data needed a hack before). | ||
1349 | */ | ||
1350 | #if defined(BUTTON_SCROLL_FWD) && defined(BUTTON_SCROLL_BACK) | ||
1351 | if((new_btn == BUTTON_SCROLL_FWD || new_btn == BUTTON_SCROLL_BACK) && | ||
1352 | pressed) | ||
1353 | { | ||
1354 | /* Clear these buttons from the data - adding them to the queue is | ||
1355 | * handled in the scrollwheel drivers for the targets. They do not | ||
1356 | * store the scroll forward/back buttons in their button data for | ||
1357 | * the button_read call. | ||
1358 | */ | ||
1359 | #ifdef HAVE_BACKLIGHT | ||
1360 | backlight_on(); | ||
1361 | #endif | ||
1362 | #ifdef HAVE_BUTTON_LIGHT | ||
1363 | buttonlight_on(); | ||
1364 | #endif | ||
1365 | queue_post(&button_queue, new_btn, 1<<24); | ||
1366 | new_btn &= ~(BUTTON_SCROLL_FWD | BUTTON_SCROLL_BACK); | ||
1367 | } | ||
1368 | #endif | ||
1369 | |||
1370 | if (pressed) | ||
1371 | btn |= new_btn; | ||
1372 | else | ||
1373 | btn &= ~new_btn; | ||
1374 | } | ||
1375 | #if defined(HAVE_BUTTON_DATA) && defined(HAVE_TOUCHSCREEN) | ||
1376 | int button_read_device(int* data) | ||
1377 | { | ||
1378 | *data = mouse_coords; | ||
1379 | #else | ||
1380 | int button_read_device(void) | ||
1381 | { | ||
1382 | #endif | ||
1383 | |||
1384 | #ifdef HAS_BUTTON_HOLD | ||
1385 | int hold_button = button_hold(); | ||
1386 | |||
1387 | #ifdef HAVE_BACKLIGHT | ||
1388 | /* light handling */ | ||
1389 | static int hold_button_old = false; | ||
1390 | if (hold_button != hold_button_old) | ||
1391 | { | ||
1392 | hold_button_old = hold_button; | ||
1393 | backlight_hold_changed(hold_button); | ||
1394 | } | ||
1395 | #endif | ||
1396 | |||
1397 | if (hold_button) | ||
1398 | return BUTTON_NONE; | ||
1399 | #endif | ||
1400 | |||
1401 | return btn; | ||
1402 | } | ||
1403 | |||
1404 | |||
1405 | #ifdef HAVE_TOUCHSCREEN | ||
1406 | extern bool debug_wps; | ||
1407 | void mouse_tick_task(void) | ||
1408 | { | ||
1409 | static int last_check = 0; | ||
1410 | int x,y; | ||
1411 | if (TIME_BEFORE(current_tick, last_check+(HZ/10))) | ||
1412 | return; | ||
1413 | last_check = current_tick; | ||
1414 | if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_LEFT)) | ||
1415 | { | ||
1416 | if(background) | ||
1417 | { | ||
1418 | x -= UI_LCD_POSX; | ||
1419 | y -= UI_LCD_POSY; | ||
1420 | |||
1421 | if(x<0 || y<0 || x>SIM_LCD_WIDTH || y>SIM_LCD_HEIGHT) | ||
1422 | return; | ||
1423 | } | ||
1424 | |||
1425 | mouse_coords = (x<<16)|y; | ||
1426 | button_event(BUTTON_TOUCHSCREEN, true); | ||
1427 | if (debug_wps) | ||
1428 | printf("Mouse at: (%d, %d)\n", x, y); | ||
1429 | } | ||
1430 | } | ||
1431 | #endif | ||
1432 | |||
1433 | void button_init_sdl(void) | ||
1434 | { | ||
1435 | #ifdef HAVE_TOUCHSCREEN | ||
1436 | tick_add_task(mouse_tick_task); | ||
1437 | #endif | ||
1438 | } | ||
1439 | |||
1440 | /* Button maps: simulated key, x, y, radius, name */ | ||
1441 | /* Run sim with --mapping to get coordinates */ | ||
1442 | /* or --debugbuttons to check */ | ||
1443 | /* The First matching button is returned */ | ||
1444 | |||
1445 | #ifdef SANSA_FUZE | ||
1446 | struct button_map bm[] = { | ||
1447 | { SDLK_KP8, 70, 265, 35, "Scroll Back" }, | ||
1448 | { SDLK_KP9, 141, 255, 31, "Play" }, | ||
1449 | { SDLK_KP_MULTIPLY, 228, 267, 18, "Home" }, | ||
1450 | { SDLK_LEFT, 69, 329, 31, "Left" }, | ||
1451 | { SDLK_SPACE, 141, 330, 20, "Select" }, | ||
1452 | { SDLK_RIGHT, 214, 331, 23, "Right" }, | ||
1453 | { SDLK_KP3, 142, 406, 30, "Menu" }, | ||
1454 | { SDLK_DOWN, 221, 384, 24, "Scroll Fwd" }, | ||
1455 | { SDLK_KP_MINUS, 270, 299, 25, "Power" }, | ||
1456 | { SDLK_h, 269, 358, 26, "Hold" }, | ||
1457 | { 0, 0, 0, 0, "None" } | ||
1458 | }; | ||
1459 | #elif defined (SANSA_CLIP) | ||
1460 | struct button_map bm[] = { | ||
1461 | { SDLK_KP_MULTIPLY, 165, 158, 17, "Home" }, | ||
1462 | { SDLK_KP5, 102, 230, 29, "Select" }, | ||
1463 | { SDLK_KP8, 100, 179, 25, "Play" }, | ||
1464 | { SDLK_KP4, 53, 231, 21, "Left" }, | ||
1465 | { SDLK_KP6, 147, 232, 19, "Right" }, | ||
1466 | { SDLK_KP2, 105, 275, 22, "Menu" }, | ||
1467 | { 0, 0, 0, 0, "None" } | ||
1468 | }; | ||
1469 | #elif defined (SANSA_C200) || defined(SANSA_C200V2) | ||
1470 | struct button_map bm[] = { | ||
1471 | |||
1472 | { SDLK_KP7, 84, 7, 21, "Vol Down" }, | ||
1473 | { SDLK_KP9, 158, 7, 20, "Vol Up" }, | ||
1474 | { SDLK_KP1, 173, 130, 27, "Record" }, | ||
1475 | { SDLK_KP5, 277, 75, 21, "Select" }, | ||
1476 | { SDLK_KP4, 233, 75, 24, "Left" }, | ||
1477 | { SDLK_KP6, 313, 74, 18, "Right" }, | ||
1478 | { SDLK_KP8, 276, 34, 15, "Play" }, | ||
1479 | { SDLK_KP2, 277, 119, 17, "Down" }, | ||
1480 | { SDLK_KP3, 314, 113, 19, "Menu" }, | ||
1481 | { 0, 0, 0, 0, "None" } | ||
1482 | }; | ||
1483 | #elif defined (SANSA_E200V2) || defined(SANSA_E200) | ||
1484 | struct button_map bm[] = { | ||
1485 | { SDLK_KP7, 5, 92, 18, "Record" }, | ||
1486 | { SDLK_KP9, 128, 295, 43, "Play" }, | ||
1487 | { SDLK_KP4, 42, 380, 33, "Left" }, | ||
1488 | { SDLK_KP5, 129, 378, 36, "Select" }, | ||
1489 | { SDLK_KP6, 218, 383, 30, "Right" }, | ||
1490 | { SDLK_KP3, 129, 461, 29, "Down" }, | ||
1491 | { SDLK_KP1, 55, 464, 20, "Menu" }, | ||
1492 | { SDLK_KP8, 92, 338, 17, "Scroll Back" }, | ||
1493 | { SDLK_KP2, 167, 342, 17, "Scroll Fwd" }, | ||
1494 | { 0, 0, 0, 0, "None" } | ||
1495 | }; | ||
1496 | #elif defined (SANSA_M200V4) | ||
1497 | struct button_map bm[] = { | ||
1498 | { SDLK_KP_PLUS, 54, 14, 16, "Power" }, | ||
1499 | { SDLK_KP7, 96, 13, 12, "Vol Down" }, | ||
1500 | { SDLK_KP9, 139, 14, 14, "Vol Up" }, | ||
1501 | { SDLK_KP5, 260, 82, 20, "Select" }, | ||
1502 | { SDLK_KP8, 258, 35, 30, "Play" }, | ||
1503 | { SDLK_KP4, 214, 84, 25, "Left" }, | ||
1504 | { SDLK_KP6, 300, 83, 24, "Right" }, | ||
1505 | { SDLK_KP2, 262, 125, 28, "Repeat" }, | ||
1506 | { SDLK_h, 113, 151, 21, "Hold" }, | ||
1507 | { 0, 0, 0, 0, "None" } | ||
1508 | }; | ||
1509 | #elif defined (IPOD_VIDEO) | ||
1510 | struct button_map bm[] = { | ||
1511 | { SDLK_KP_PERIOD, 174, 350, 35, "Menu" }, | ||
1512 | { SDLK_KP8, 110, 380, 33, "Scroll Back" }, | ||
1513 | { SDLK_KP2, 234, 377, 34, "Scroll Fwd" }, | ||
1514 | { SDLK_KP4, 78, 438, 47, "Left" }, | ||
1515 | { SDLK_KP5, 172, 435, 43, "Select" }, | ||
1516 | { SDLK_KP6, 262, 438, 52, "Right" }, | ||
1517 | { SDLK_KP_PLUS, 172, 519, 43, "Play" }, | ||
1518 | { 0, 0, 0 , 0, "None" } | ||
1519 | }; | ||
1520 | #elif defined (IPOD_MINI) || defined(IPOD_MINI2G) | ||
1521 | struct button_map bm[] = { | ||
1522 | { SDLK_KP5, 92, 267, 29, "Select" }, | ||
1523 | { SDLK_KP4, 31, 263, 37, "Left" }, | ||
1524 | { SDLK_KP6, 150, 268, 33, "Right" }, | ||
1525 | { SDLK_KP_PERIOD, 93, 209, 30, "Menu" }, | ||
1526 | { SDLK_KP_PLUS, 93, 324, 25, "Play" }, | ||
1527 | { SDLK_KP8, 53, 220, 29, "Scroll Back" }, | ||
1528 | { SDLK_KP2, 134, 219, 31, "Scroll Fwd" }, | ||
1529 | { 0, 0, 0 , 0, "None" } | ||
1530 | }; | ||
1531 | #elif defined (IPOD_3G) | ||
1532 | struct button_map bm[] = { | ||
1533 | { SDLK_KP5, 108, 296, 26, "Select" }, | ||
1534 | { SDLK_KP8, 70, 255, 26, "Scroll Back" }, | ||
1535 | { SDLK_KP2, 149, 256, 28, "Scroll Fwd" }, | ||
1536 | { SDLK_KP4, 27, 186, 22, "Left" }, | ||
1537 | { SDLK_KP_PERIOD, 82, 185, 22, "Menu" }, | ||
1538 | { SDLK_KP_PERIOD, 133, 185, 21, "Play" }, | ||
1539 | { SDLK_KP6, 189, 188, 21, "Right" }, | ||
1540 | { 0, 0, 0 , 0, "None" } | ||
1541 | }; | ||
1542 | #elif defined (IPOD_4G) | ||
1543 | struct button_map bm[] = { | ||
1544 | { SDLK_KP5, 96, 269, 27, "Select" }, | ||
1545 | { SDLK_KP4, 39, 267, 30, "Left" }, | ||
1546 | { SDLK_KP6, 153, 270, 27, "Right" }, | ||
1547 | { SDLK_KP_PERIOD, 96, 219, 30, "Menu" }, | ||
1548 | { SDLK_KP_PLUS, 95, 326, 27, "Play" }, | ||
1549 | { SDLK_KP8, 57, 233, 29, "Scroll Back" }, | ||
1550 | { SDLK_KP2, 132, 226, 29, "Scroll Fwd" }, | ||
1551 | { 0, 0, 0 , 0, "None" } | ||
1552 | }; | ||
1553 | #elif defined (IPOD_COLOR) | ||
1554 | struct button_map bm[] = { | ||
1555 | { SDLK_KP5, 128, 362, 35, "Select" }, | ||
1556 | { SDLK_KP4, 55, 358, 38, "Left" }, | ||
1557 | { SDLK_KP6, 203, 359, 39, "Right" }, | ||
1558 | { SDLK_KP_PERIOD, 128, 282, 34, "Menu" }, | ||
1559 | { SDLK_KP_PLUS, 129, 439, 41, "Play" }, | ||
1560 | { SDLK_KP8, 76, 309, 34, "Scroll Back" }, | ||
1561 | { SDLK_KP2, 182, 311, 45, "Scroll Fwd" }, | ||
1562 | { 0, 0, 0 , 0, "None" } | ||
1563 | }; | ||
1564 | #elif defined (IPOD_1G2G) | ||
1565 | struct button_map bm[] = { | ||
1566 | { SDLK_KP5, 112, 265, 31, "Select" }, | ||
1567 | { SDLK_KP8, 74, 224, 28, "Scroll Back" }, | ||
1568 | { SDLK_KP2, 146, 228, 28, "Scroll Fwd" }, | ||
1569 | /* Dummy button to make crescent shape */ | ||
1570 | { SDLK_y, 112, 265, 76, "None" }, | ||
1571 | { SDLK_KP8, 74, 224, 28, "Scroll Back" }, | ||
1572 | { SDLK_KP2, 146, 228, 28, "Scroll Fwd" }, | ||
1573 | { SDLK_KP6, 159, 268, 64, "Right" }, | ||
1574 | { SDLK_KP4, 62, 266, 62, "Left" }, | ||
1575 | { SDLK_KP_PERIOD, 111, 216, 64, "Menu" }, | ||
1576 | { SDLK_KP_PLUS, 111, 326, 55, "Down" }, | ||
1577 | { 0, 0, 0 , 0, "None" } | ||
1578 | }; | ||
1579 | #elif defined (IPOD_NANO) | ||
1580 | struct button_map bm[] = { | ||
1581 | { SDLK_KP5, 98, 316, 37, "Select" }, | ||
1582 | { SDLK_KP4, 37, 312, 28, "Left" }, | ||
1583 | { SDLK_KP6, 160, 313, 25, "Right" }, | ||
1584 | { SDLK_KP_PERIOD,102, 256, 23, "Menu" }, | ||
1585 | { SDLK_KP_PLUS, 99, 378, 28, "Play" }, | ||
1586 | { SDLK_KP8, 58, 272, 24, "Scroll Back" }, | ||
1587 | { SDLK_KP2, 141, 274, 22, "Scroll Fwd" }, | ||
1588 | { 0, 0, 0 , 0, "None" } | ||
1589 | }; | ||
1590 | #elif defined (IPOD_NANO2G) | ||
1591 | struct button_map bm[] = { | ||
1592 | { SDLK_KP5, 118, 346, 37, "Select" }, | ||
1593 | { SDLK_KP4, 51, 345, 28, "Left" }, | ||
1594 | { SDLK_KP6, 180, 346, 26, "Right" }, | ||
1595 | { SDLK_KP_PERIOD, 114, 286, 23, "Menu" }, | ||
1596 | { SDLK_KP_PLUS, 115, 412, 27, "Down" }, | ||
1597 | { SDLK_KP8, 67, 303, 28, "Scroll Back" }, | ||
1598 | { SDLK_KP2, 163, 303, 27, "Scroll Fwd" }, | ||
1599 | { 0, 0, 0 , 0, "None" } | ||
1600 | }; | ||
1601 | #elif defined (COWON_D2) | ||
1602 | struct button_map bm[] = { | ||
1603 | { SDLK_DELETE, 51, 14, 17, "Power" }, | ||
1604 | { SDLK_h, 138, 14, 16, "Hold" }, | ||
1605 | { SDLK_MINUS, 320, 14, 10, "Minus" }, | ||
1606 | { SDLK_INSERT, 347, 13, 13, "Menu" }, | ||
1607 | { SDLK_KP_PLUS, 374, 14, 12, "Plus" }, | ||
1608 | { 0, 0, 0, 0, "None" } | ||
1609 | }; | ||
1610 | #elif defined (IAUDIO_M3) | ||
1611 | struct button_map bm[] = { | ||
1612 | { SDLK_KP5, 256, 72, 29, "Play" }, | ||
1613 | { SDLK_KP6, 255, 137, 28, "Right" }, | ||
1614 | { SDLK_KP4, 257, 201, 26, "Left" }, | ||
1615 | { SDLK_KP8, 338, 31, 27, "Up" }, | ||
1616 | { SDLK_KP2, 339, 92, 23, "Down" }, | ||
1617 | { SDLK_KP_PERIOD, 336, 50, 23, "Mode" }, | ||
1618 | { SDLK_KP_DIVIDE, 336, 147, 23, "Rec" }, | ||
1619 | { SDLK_h, 336, 212, 30, "Hold" }, | ||
1620 | /* remote */ | ||
1621 | { SDLK_SPACE, 115, 308, 20, "RC Play" }, | ||
1622 | { SDLK_RIGHT, 85, 308, 20, "RC Rew" }, | ||
1623 | { SDLK_LEFT, 143, 308, 20, "RC FF" }, | ||
1624 | { SDLK_UP, 143, 498, 20, "RC Up" }, | ||
1625 | { SDLK_DOWN, 85, 498, 20, "RC Down" }, | ||
1626 | { SDLK_INSERT, 212, 308, 30, "RC Mode" }, | ||
1627 | { SDLK_F1, 275, 308, 25, "RC Rec" }, | ||
1628 | { SDLK_KP_ENTER, 115, 498, 20, "RC Menu" }, | ||
1629 | { 0, 0, 0, 0, "None" } | ||
1630 | }; | ||
1631 | #elif defined (IAUDIO_M5) | ||
1632 | struct button_map bm[] = { | ||
1633 | { SDLK_KP_ENTER, 333, 41, 17, "Enter" }, | ||
1634 | { SDLK_h, 334, 74, 21, "Hold" }, | ||
1635 | { SDLK_KP_DIVIDE, 333, 142, 24, "Record" }, | ||
1636 | { SDLK_KP_PLUS, 332, 213, 20, "Play" }, | ||
1637 | { SDLK_KP5, 250, 291, 19, "Select" }, | ||
1638 | { SDLK_KP8, 249, 236, 32, "Up" }, | ||
1639 | { SDLK_KP4, 194, 292, 29, "Left" }, | ||
1640 | { SDLK_KP6, 297, 290, 27, "Right" }, | ||
1641 | { SDLK_KP2, 252, 335, 28, "Down" }, | ||
1642 | { 0, 0, 0, 0, "None" } | ||
1643 | }; | ||
1644 | #elif defined (IAUDIO_7) | ||
1645 | struct button_map bm[] = { | ||
1646 | { 0, 0, 0, 0, "None" } | ||
1647 | }; | ||
1648 | #elif defined (IAUDIO_X5) | ||
1649 | struct button_map bm[] = { | ||
1650 | { SDLK_KP_ENTER, 275, 38, 17, "Power" }, | ||
1651 | { SDLK_h, 274, 83, 16, "Hold" }, | ||
1652 | { SDLK_KP_DIVIDE, 276, 128, 22, "Record" }, | ||
1653 | { SDLK_KP_PLUS, 274, 186, 22, "Play" }, | ||
1654 | { SDLK_KP5, 200, 247, 16, "Select" }, | ||
1655 | { SDLK_KP8, 200, 206, 16, "Up" }, | ||
1656 | { SDLK_KP4, 163, 248, 19, "Left" }, | ||
1657 | { SDLK_KP6, 225, 247, 24, "Right" }, | ||
1658 | { SDLK_KP2, 199, 279, 20, "Down" }, | ||
1659 | { 0, 0, 0, 0, "None" } | ||
1660 | }; | ||
1661 | #elif defined (ARCHOS_PLAYER) | ||
1662 | struct button_map bm[] = { | ||
1663 | { SDLK_KP_PLUS, 79, 252, 23, "On" }, | ||
1664 | { SDLK_KP_PERIOD, 81, 310, 20, "Menu" }, | ||
1665 | { SDLK_KP8, 154, 237, 28, "Play" }, | ||
1666 | { SDLK_KP4, 121, 282, 23, "Left" }, | ||
1667 | { SDLK_KP6, 187, 282, 22, "Right" }, | ||
1668 | { SDLK_KP2, 157, 312, 20, "Down" }, | ||
1669 | { 0, 0, 0, 0, "None" } | ||
1670 | }; | ||
1671 | #elif defined (ARCHOS_RECORDER) | ||
1672 | struct button_map bm[] = { | ||
1673 | { SDLK_F1, 94, 205, 22, "F1" }, | ||
1674 | { SDLK_F2, 136, 204, 21, "F2" }, | ||
1675 | { SDLK_F3, 174, 204, 24, "F3" }, | ||
1676 | { SDLK_KP_PLUS, 75, 258, 19, "On" }, | ||
1677 | { SDLK_KP_ENTER, 76, 307, 15, "Off" }, | ||
1678 | { SDLK_KP5, 151, 290, 20, "Select" }, | ||
1679 | { SDLK_KP8, 152, 251, 23, "Up" }, | ||
1680 | { SDLK_KP4, 113, 288, 26, "Left" }, | ||
1681 | { SDLK_KP6, 189, 291, 23, "Right" }, | ||
1682 | { SDLK_KP2, 150, 327, 27, "Down" }, | ||
1683 | { 0, 0, 0, 0, "None" } | ||
1684 | }; | ||
1685 | #elif defined (ARCHOS_FMRECORDER) || defined (ARCHOS_RECORDERV2) | ||
1686 | struct button_map bm[] = { | ||
1687 | { SDLK_F1, 88, 210, 28, "F1" }, | ||
1688 | { SDLK_F2, 144, 212, 28, "F2" }, | ||
1689 | { SDLK_F3, 197, 212, 28, "F3" }, | ||
1690 | { SDLK_KP5, 144, 287, 21, "Select" }, | ||
1691 | { SDLK_KP_PLUS, 86, 320, 13, "Menu" }, | ||
1692 | { SDLK_KP_ENTER, 114, 347, 13, "Stop" }, | ||
1693 | { SDLK_y, 144, 288, 31, "None" }, | ||
1694 | { SDLK_KP8, 144, 259, 25, "Up" }, | ||
1695 | { SDLK_KP2, 144, 316, 31, "Down" }, | ||
1696 | { SDLK_KP6, 171, 287, 32, "Right" }, | ||
1697 | { SDLK_KP4, 117, 287, 31, "Left" }, | ||
1698 | { 0, 0, 0, 0, "None" } | ||
1699 | }; | ||
1700 | #elif defined (ARCHOS_ONDIOSP) || defined (ARCHOS_ONDIOFM) | ||
1701 | struct button_map bm[] = { | ||
1702 | { SDLK_KP_ENTER, 75, 23, 30, "Enter" }, | ||
1703 | { SDLK_KP8, 75, 174, 33, "KP8" }, | ||
1704 | { SDLK_KP4, 26, 186, 48, "KP4" }, | ||
1705 | { SDLK_KP6, 118, 196, 32, "KP6" }, | ||
1706 | { SDLK_KP2, 75, 234, 16, "KP2" }, | ||
1707 | { SDLK_KP_PERIOD, 54, 250, 24, "Period" }, | ||
1708 | { 0, 0, 0, 0, "None" } | ||
1709 | }; | ||
1710 | #elif defined (IRIVER_H10) | ||
1711 | struct button_map bm[] = { | ||
1712 | { SDLK_KP_PLUS, 38, 70, 37, "Power" }, | ||
1713 | { SDLK_KP4, 123, 194, 26, "Cancel" }, | ||
1714 | { SDLK_KP6, 257, 195, 34, "Select" }, | ||
1715 | { SDLK_KP8, 190, 221, 28, "Up" }, | ||
1716 | { SDLK_KP2, 192, 320, 27, "Down" }, | ||
1717 | { SDLK_KP_DIVIDE, 349, 49, 20, "Rew" }, | ||
1718 | { SDLK_KP5, 349, 96, 20, "Play" }, | ||
1719 | { SDLK_KP_MULTIPLY, 350, 141, 23, "FF" }, | ||
1720 | { 0, 0, 0, 0, "None" } | ||
1721 | }; | ||
1722 | #elif defined (IRIVER_H10_5GB) | ||
1723 | struct button_map bm[] = { | ||
1724 | { SDLK_KP_PLUS, 34, 76, 23, "Power" }, | ||
1725 | { SDLK_KP4, 106, 222, 28, "Cancel" }, | ||
1726 | { SDLK_KP6, 243, 220, 31, "Select" }, | ||
1727 | { SDLK_KP8, 176, 254, 34, "Up" }, | ||
1728 | { SDLK_KP2, 175, 371, 35, "Down" }, | ||
1729 | { SDLK_KP_DIVIDE, 319, 63, 26, "Rew" }, | ||
1730 | { SDLK_KP5, 320, 124, 26, "Play" }, | ||
1731 | { SDLK_KP_MULTIPLY, 320, 181, 32, "FF" }, | ||
1732 | { 0, 0, 0, 0, "None" } | ||
1733 | }; | ||
1734 | #elif defined (IRIVER_H120) || defined (IRIVER_H100) | ||
1735 | struct button_map bm[] = { | ||
1736 | { SDLK_KP_DIVIDE, 46, 162, 13, "Record" }, | ||
1737 | { SDLK_KP_PLUS, 327, 36, 16, "Play" }, | ||
1738 | { SDLK_KP_ENTER, 330, 99, 18, "Stop" }, | ||
1739 | { SDLK_KP_PERIOD, 330, 163, 18, "AB" }, | ||
1740 | { SDLK_KP5, 186, 227, 27, "5" }, | ||
1741 | { SDLK_KP8, 187, 185, 19, "8" }, | ||
1742 | { SDLK_KP4, 142, 229, 23, "4" }, | ||
1743 | { SDLK_KP6, 231, 229, 22, "6" }, | ||
1744 | { SDLK_KP2, 189, 272, 28, "2" }, | ||
1745 | /* Remote Buttons */ | ||
1746 | { SDLK_KP_ENTER, 250, 404, 20, "Stop" }, | ||
1747 | { SDLK_SPACE, 285, 439, 29, "Space" }, | ||
1748 | { SDLK_h, 336, 291, 24, "Hold" }, | ||
1749 | { 0, 0, 0, 0, "None" } | ||
1750 | }; | ||
1751 | #elif defined (IRIVER_H300) | ||
1752 | struct button_map bm[] = { | ||
1753 | { SDLK_KP_PLUS, 56, 335, 20, "Play" }, | ||
1754 | { SDLK_KP8, 140, 304, 29, "Up" }, | ||
1755 | { SDLK_KP_DIVIDE, 233, 331, 23, "Record" }, | ||
1756 | { SDLK_KP_ENTER, 54, 381, 24, "Stop" }, | ||
1757 | { SDLK_KP4, 100, 353, 17, "Left" }, | ||
1758 | { SDLK_KP5, 140, 351, 19, "Navi" }, | ||
1759 | { SDLK_KP6, 185, 356, 19, "Right" }, | ||
1760 | { SDLK_KP_PERIOD, 230, 380, 20, "AB" }, | ||
1761 | { SDLK_KP2, 142, 402, 24, "Down" }, | ||
1762 | { SDLK_KP_ENTER, 211, 479, 21, "Stop" }, | ||
1763 | { SDLK_KP_PLUS, 248, 513, 29, "Play" }, | ||
1764 | { 0, 0, 0, 0, "None" } | ||
1765 | }; | ||
1766 | #elif defined (MROBE_500) | ||
1767 | struct button_map bm[] = { | ||
1768 | { SDLK_KP9, 171, 609, 9, "Play" }, | ||
1769 | { SDLK_KP4, 158, 623, 9, "Left" }, | ||
1770 | { SDLK_KP6, 184, 622, 9, "Right" }, | ||
1771 | { SDLK_KP7, 171, 638, 11, "Menu" }, | ||
1772 | { 0, 0, 0, 0, "None" } | ||
1773 | }; | ||
1774 | #elif defined (MROBE_100) | ||
1775 | struct button_map bm[] = { | ||
1776 | { SDLK_KP7, 80, 233, 30, "Menu" }, | ||
1777 | { SDLK_KP8, 138, 250, 19, "Up" }, | ||
1778 | { SDLK_KP9, 201, 230, 27, "Play" }, | ||
1779 | { SDLK_KP4, 63, 305, 25, "Left" }, | ||
1780 | { SDLK_KP5, 125, 309, 28, "Select" }, | ||
1781 | { SDLK_KP6, 200, 307, 35, "Right" }, | ||
1782 | { SDLK_KP1, 52, 380, 32, "Display" }, | ||
1783 | { SDLK_KP2, 125, 363, 30, "Down" }, | ||
1784 | { SDLK_KP9, 168, 425, 10, "Play" }, | ||
1785 | { SDLK_KP4, 156, 440, 11, "Left" }, | ||
1786 | { SDLK_KP6, 180, 440, 13, "Right" }, | ||
1787 | { SDLK_KP7, 169, 452, 10, "Menu" }, | ||
1788 | { SDLK_KP_MULTIPLY, 222, 15, 16, "Power" }, | ||
1789 | { 0, 0, 0, 0, "None" } | ||
1790 | }; | ||
1791 | #elif defined (GIGABEAT_F) | ||
1792 | struct button_map bm[] = { | ||
1793 | { SDLK_KP_PLUS, 361, 187, 22, "Power" }, | ||
1794 | { SDLK_KP_PERIOD, 361, 270, 17, "Menu" }, | ||
1795 | { SDLK_KP9, 365, 345, 26, "Vol Up" }, | ||
1796 | { SDLK_KP3, 363, 433, 25, "Vol Down" }, | ||
1797 | { SDLK_KP_ENTER, 365, 520, 19, "A" }, | ||
1798 | { SDLK_KP8, 167, 458, 35, "Up" }, | ||
1799 | { SDLK_KP4, 86, 537, 29, "Left" }, | ||
1800 | { SDLK_KP5, 166, 536, 30, "Select" }, | ||
1801 | { SDLK_KP6, 248, 536, 30, "Right" }, | ||
1802 | { SDLK_KP2, 169, 617, 28, "Down" }, | ||
1803 | { 0, 0, 0, 0, "None" } | ||
1804 | }; | ||
1805 | #elif defined (GIGABEAT_S) | ||
1806 | struct button_map bm[] = { | ||
1807 | { SDLK_KP_PLUS, 416, 383, 23, "Play" }, | ||
1808 | { SDLK_KP7, 135, 442, 46, "Back" }, | ||
1809 | { SDLK_KP9, 288, 447, 35, "Menu" }, | ||
1810 | { SDLK_KP8, 214, 480, 32, "Up" }, | ||
1811 | { SDLK_KP4, 128, 558, 33, "Left" }, | ||
1812 | { SDLK_KP5, 214, 556, 34, "Select" }, | ||
1813 | { SDLK_KP6, 293, 558, 35, "Right" }, | ||
1814 | { SDLK_KP2, 214, 637, 38, "Down" }, | ||
1815 | { 0, 0, 0, 0, "None" } | ||
1816 | }; | ||
1817 | #elif defined (SAMSUNG_YH820) | ||
1818 | struct button_map bm[] = { | ||
1819 | { SDLK_KP_PLUS, 330, 53, 23, "Record" }, | ||
1820 | { SDLK_KP7, 132, 208, 21, "Left" }, | ||
1821 | { SDLK_KP5, 182, 210, 18, "Play" }, | ||
1822 | { SDLK_KP9, 234, 211, 22, "Right" }, | ||
1823 | { SDLK_KP8, 182, 260, 15, "Up" }, | ||
1824 | { SDLK_KP4, 122, 277, 29, "Menu" }, | ||
1825 | { SDLK_KP6, 238, 276, 25, "Select" }, | ||
1826 | { SDLK_KP2, 183, 321, 24, "Down" }, | ||
1827 | { 0, 0, 0, 0, "None" } | ||
1828 | }; | ||
1829 | #elif defined (SAMSUNG_YH920) || defined (SAMSUNG_YH925) | ||
1830 | struct button_map bm[] = { | ||
1831 | { SDLK_KP9, 370, 32, 15, "FF" }, | ||
1832 | { SDLK_KP5, 369, 84, 25, "Play" }, | ||
1833 | { SDLK_KP5, 367, 125, 27, "Play" }, | ||
1834 | { SDLK_KP3, 369, 188, 17, "Rew" }, | ||
1835 | { SDLK_KP_PLUS, 370, 330, 30, "Record" }, | ||
1836 | { SDLK_KP4, 146, 252, 32, "Menu" }, | ||
1837 | { SDLK_KP8, 204, 226, 27, "Up" }, | ||
1838 | { SDLK_KP6, 257, 250, 34, "Select" }, | ||
1839 | { SDLK_KP2, 205, 294, 35, "Down" }, | ||
1840 | { 0, 0, 0, 0, "None" } | ||
1841 | }; | ||
1842 | #elif defined (ONDA_VX747) || defined (ONDA_VX747P) | ||
1843 | struct button_map bm[] = { | ||
1844 | { SDLK_MINUS, 113, 583, 28, "Minus" }, | ||
1845 | { SDLK_PLUS, 227, 580, 28, "Plus" }, | ||
1846 | { SDLK_RETURN, 171, 583, 34, "Menu" }, | ||
1847 | { 0, 0, 0, 0, "None" } | ||
1848 | }; | ||
1849 | #elif defined (PHILIPS_SA9200) | ||
1850 | struct button_map bm[] = { | ||
1851 | { SDLK_KP_ENTER, 25, 155, 33, "Power" }, | ||
1852 | { SDLK_PAGEUP, 210, 98, 31, "Vol Up" }, | ||
1853 | { SDLK_PAGEDOWN, 210, 168, 34, "Vol Down" }, | ||
1854 | { SDLK_KP7, 40, 249, 26, "Prev" }, | ||
1855 | { SDLK_KP8, 110, 247, 22, "Up" }, | ||
1856 | { SDLK_KP9, 183, 249, 31, "Next" }, | ||
1857 | { SDLK_KP4, 45, 305, 25, "Left" }, | ||
1858 | { SDLK_KP5, 111, 304, 24, "Play" }, | ||
1859 | { SDLK_KP6, 183, 304, 21, "Right" }, | ||
1860 | { SDLK_KP1, 43, 377, 21, "Menu" }, | ||
1861 | { SDLK_KP2, 112, 371, 24, "Down" }, | ||
1862 | { 0, 0, 0, 0, "None" } | ||
1863 | }; | ||
1864 | #elif defined (CREATIVE_ZVM) || defined (CREATIVE_ZVM60GB) || \ | ||
1865 | defined (CREATIVE_ZV) | ||
1866 | struct button_map bm[] = { | ||
1867 | { SDLK_KP7, 52, 414, 35, "Custom" }, | ||
1868 | { SDLK_KP8, 185, 406, 55, "Up" }, | ||
1869 | { SDLK_KP9, 315, 421, 46, "Play" }, | ||
1870 | { SDLK_KP4, 122, 500, 41, "Left" }, | ||
1871 | { SDLK_KP6, 247, 493, 49, "Right" }, | ||
1872 | { SDLK_KP1, 58, 577, 49, "Back" }, | ||
1873 | { SDLK_KP2, 186, 585, 46, "Down" }, | ||
1874 | { SDLK_KP3, 311, 569, 47, "Menu" }, | ||
1875 | { 0, 0, 0, 0, "None" } | ||
1876 | }; | ||
1877 | #elif defined (MPIO_HD200) | ||
1878 | struct button_map bm[] = { | ||
1879 | { SDLK_ESCAPE, 369, 257, 20, "Rec" }, | ||
1880 | { SDLK_RETURN, 369, 305, 20, "Play/Stop" }, | ||
1881 | { SDLK_UP, 353, 168, 10, "Rew" }, | ||
1882 | { SDLK_DOWN, 353, 198, 10, "FF" }, | ||
1883 | { SDLK_SPACE, 353, 186, 10, "Select" }, | ||
1884 | { SDLK_LEFT, 123, 67, 20, "Vol Down" }, | ||
1885 | { SDLK_RIGHT, 206, 67, 20, "Vol Up" }, | ||
1886 | { SDLK_h, 369, 402, 30, "Hold" }, | ||
1887 | { 0, 0, 0, 0, "None" } | ||
1888 | }; | ||
1889 | #else | ||
1890 | struct button_map bm[] = { | ||
1891 | { 0, 0, 0, 0, ""} | ||
1892 | }; | ||
1893 | #endif | ||
1894 | |||
1895 | int xy2button( int x, int y) { | ||
1896 | int i; | ||
1897 | extern bool debug_buttons; | ||
1898 | |||
1899 | for ( i = 0; bm[i].button; i++ ) | ||
1900 | /* check distance from center of button < radius */ | ||
1901 | if ( ( (x-bm[i].x)*(x-bm[i].x) ) + ( ( y-bm[i].y)*(y-bm[i].y) ) < bm[i].radius*bm[i].radius ) { | ||
1902 | if (debug_buttons) | ||
1903 | printf("Button: %s\n", bm[i].description ); | ||
1904 | return bm[i].button; | ||
1905 | } | ||
1906 | return 0; | ||
1907 | } | ||