diff options
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/keymaps/keymap-sdl.c | 216 | ||||
-rw-r--r-- | firmware/export/config.h | 1 | ||||
-rw-r--r-- | firmware/export/config/application.h | 7 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/app/button-application.c | 56 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/app/button-target.h | 37 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 18 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/key_to_touch-sdl.c | 9 | ||||
-rw-r--r-- | uisimulator/buttonmap/ipod.c | 6 | ||||
-rw-r--r-- | uisimulator/buttonmap/sansa-e200.c | 6 | ||||
-rw-r--r-- | uisimulator/buttonmap/sansa-fuze.c | 6 |
11 files changed, 335 insertions, 29 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index a00239428c..9bc8859746 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -295,4 +295,6 @@ keymaps/keymap-vibe500.c | |||
295 | keymaps/keymap-mpio-hd200.c | 295 | keymaps/keymap-mpio-hd200.c |
296 | #elif CONFIG_KEYPAD == ANDROID_PAD | 296 | #elif CONFIG_KEYPAD == ANDROID_PAD |
297 | keymaps/keymap-android.c | 297 | keymaps/keymap-android.c |
298 | #elif CONFIG_KEYPAD == SDL_PAD | ||
299 | keymaps/keymap-sdl.c | ||
298 | #endif | 300 | #endif |
diff --git a/apps/keymaps/keymap-sdl.c b/apps/keymaps/keymap-sdl.c new file mode 100644 index 0000000000..ce10c5cf17 --- /dev/null +++ b/apps/keymaps/keymap-sdl.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Maurus Cuelenaere | ||
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 | /* Button Code Definitions for Android targets */ | ||
23 | |||
24 | #include <stdio.h> | ||
25 | #include <string.h> | ||
26 | #include <stdlib.h> | ||
27 | |||
28 | #include "config.h" | ||
29 | #include "action.h" | ||
30 | #include "button.h" | ||
31 | #include "settings.h" | ||
32 | |||
33 | /* | ||
34 | * The format of the list is as follows | ||
35 | * { Action Code, Button code, Prereq button code } | ||
36 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
37 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
38 | */ | ||
39 | |||
40 | static const struct button_mapping button_context_standard[] = { | ||
41 | { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
42 | { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
43 | { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
44 | { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
45 | |||
46 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
47 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
48 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
49 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
50 | |||
51 | { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER }, | ||
52 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
53 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
54 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
55 | |||
56 | { ACTION_STD_CONTEXT, BUTTON_MENU, BUTTON_NONE }, | ||
57 | |||
58 | LAST_ITEM_IN_LIST | ||
59 | }; /* button_context_standard */ | ||
60 | |||
61 | static const struct button_mapping button_context_wps[] = { | ||
62 | { ACTION_WPS_BROWSE, BUTTON_BACK, BUTTON_NONE }, | ||
63 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
64 | { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, | ||
65 | |||
66 | { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
67 | { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
68 | { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
69 | { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
70 | |||
71 | LAST_ITEM_IN_LIST | ||
72 | }; /* button_context_wps */ | ||
73 | |||
74 | static const struct button_mapping button_context_list[] = { | ||
75 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
76 | }; /* button_context_list */ | ||
77 | |||
78 | static const struct button_mapping button_context_tree[] = { | ||
79 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
80 | }; /* button_context_tree */ | ||
81 | |||
82 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
83 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
84 | }; | ||
85 | |||
86 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
87 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
88 | }; | ||
89 | |||
90 | static const struct button_mapping button_context_settings[] = { | ||
91 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, | ||
92 | { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
93 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, | ||
94 | { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
95 | { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE }, | ||
96 | { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, | ||
97 | { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
98 | { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
99 | { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
100 | { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
101 | |||
102 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
103 | }; /* button_context_settings */ | ||
104 | |||
105 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
106 | { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
107 | { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
108 | { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
109 | { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT,BUTTON_NONE }, | ||
110 | |||
111 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
112 | }; /* button_context_settingsgraphical */ | ||
113 | |||
114 | static const struct button_mapping button_context_yesno[] = { | ||
115 | { ACTION_YESNO_ACCEPT, BUTTON_CENTER, BUTTON_NONE }, | ||
116 | |||
117 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
118 | }; /* button_context_settings_yesno */ | ||
119 | |||
120 | static const struct button_mapping button_context_colorchooser[] = { | ||
121 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
122 | }; /* button_context_colorchooser */ | ||
123 | |||
124 | static const struct button_mapping button_context_eq[] = { | ||
125 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
126 | }; /* button_context_eq */ | ||
127 | |||
128 | /** Bookmark Screen **/ | ||
129 | static const struct button_mapping button_context_bmark[] = { | ||
130 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
131 | }; /* button_context_bmark */ | ||
132 | |||
133 | static const struct button_mapping button_context_time[] = { | ||
134 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
135 | }; /* button_context_time */ | ||
136 | |||
137 | static const struct button_mapping button_context_quickscreen[] = { | ||
138 | { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_NONE }, | ||
139 | |||
140 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
141 | }; /* button_context_quickscreen */ | ||
142 | |||
143 | static const struct button_mapping button_context_pitchscreen[] = { | ||
144 | |||
145 | { ACTION_PS_INC_SMALL, BUTTON_RIGHT, BUTTON_NONE }, | ||
146 | { ACTION_PS_INC_BIG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
147 | { ACTION_PS_DEC_SMALL, BUTTON_LEFT, BUTTON_NONE }, | ||
148 | { ACTION_PS_DEC_BIG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
149 | { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE }, | ||
150 | |||
151 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
152 | }; /* button_context_pitchcreen */ | ||
153 | |||
154 | static const struct button_mapping button_context_keyboard[] = { | ||
155 | { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE }, | ||
156 | { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
157 | { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
158 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
159 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
160 | |||
161 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
162 | }; /* button_context_keyboard */ | ||
163 | |||
164 | static const struct button_mapping button_context_radio[] = { | ||
165 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
166 | }; /* button_context_radio */ | ||
167 | |||
168 | const struct button_mapping* target_get_context_mapping(int context) | ||
169 | { | ||
170 | switch (context) | ||
171 | { | ||
172 | case CONTEXT_STD: | ||
173 | return button_context_standard; | ||
174 | case CONTEXT_WPS: | ||
175 | return button_context_wps; | ||
176 | |||
177 | case CONTEXT_LIST: | ||
178 | return button_context_list; | ||
179 | case CONTEXT_MAINMENU: | ||
180 | case CONTEXT_TREE: | ||
181 | if (global_settings.hold_lr_for_scroll_in_list) | ||
182 | return button_context_listtree_scroll_without_combo; | ||
183 | else | ||
184 | return button_context_listtree_scroll_with_combo; | ||
185 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
186 | return button_context_tree; | ||
187 | |||
188 | case CONTEXT_SETTINGS: | ||
189 | return button_context_settings; | ||
190 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
191 | case CONTEXT_SETTINGS_RECTRIGGER: | ||
192 | return button_context_settings_right_is_inc; | ||
193 | |||
194 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
195 | return button_context_colorchooser; | ||
196 | case CONTEXT_SETTINGS_EQ: | ||
197 | return button_context_eq; | ||
198 | |||
199 | case CONTEXT_SETTINGS_TIME: | ||
200 | return button_context_time; | ||
201 | |||
202 | case CONTEXT_YESNOSCREEN: | ||
203 | return button_context_yesno; | ||
204 | case CONTEXT_FM: | ||
205 | return button_context_radio; | ||
206 | case CONTEXT_BOOKMARKSCREEN: | ||
207 | return button_context_bmark; | ||
208 | case CONTEXT_QUICKSCREEN: | ||
209 | return button_context_quickscreen; | ||
210 | case CONTEXT_PITCHSCREEN: | ||
211 | return button_context_pitchscreen; | ||
212 | case CONTEXT_KEYBOARD: | ||
213 | return button_context_keyboard; | ||
214 | } | ||
215 | return button_context_standard; | ||
216 | } | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 409c9d9965..83a9ea4feb 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -129,6 +129,7 @@ | |||
129 | #define PBELL_VIBE500_PAD 43 | 129 | #define PBELL_VIBE500_PAD 43 |
130 | #define MPIO_HD200_PAD 44 | 130 | #define MPIO_HD200_PAD 44 |
131 | #define ANDROID_PAD 45 | 131 | #define ANDROID_PAD 45 |
132 | #define SDL_PAD 46 | ||
132 | 133 | ||
133 | /* CONFIG_REMOTE_KEYPAD */ | 134 | /* CONFIG_REMOTE_KEYPAD */ |
134 | #define H100_REMOTE 1 | 135 | #define H100_REMOTE 1 |
diff --git a/firmware/export/config/application.h b/firmware/export/config/application.h index 6a87d5f62a..6219aa6fad 100644 --- a/firmware/export/config/application.h +++ b/firmware/export/config/application.h | |||
@@ -75,10 +75,13 @@ | |||
75 | /* Define this if you do software codec */ | 75 | /* Define this if you do software codec */ |
76 | #define CONFIG_CODEC SWCODEC | 76 | #define CONFIG_CODEC SWCODEC |
77 | 77 | ||
78 | #ifdef ANDROID | 78 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) |
79 | #define CONFIG_KEYPAD ANDROID_PAD | 79 | #define CONFIG_KEYPAD ANDROID_PAD |
80 | #elif (CONFIG_PLATFORM & PLATFORM_SDL) | ||
81 | #define HAVE_SCROLLWHEEL | ||
82 | #define CONFIG_KEYPAD SDL_PAD | ||
80 | #else | 83 | #else |
81 | #define CONFIG_KEYPAD COWON_D2_PAD | 84 | #error unknown platform |
82 | #endif | 85 | #endif |
83 | 86 | ||
84 | #if (CONFIG_PLATFORM & PLATFORM_SDL) | 87 | #if (CONFIG_PLATFORM & PLATFORM_SDL) |
diff --git a/firmware/target/hosted/sdl/app/button-application.c b/firmware/target/hosted/sdl/app/button-application.c index a27f769718..3f31933951 100644 --- a/firmware/target/hosted/sdl/app/button-application.c +++ b/firmware/target/hosted/sdl/app/button-application.c | |||
@@ -20,10 +20,62 @@ | |||
20 | ***************************************************9*************************/ | 20 | ***************************************************9*************************/ |
21 | 21 | ||
22 | 22 | ||
23 | #include <stdio.h> | ||
24 | #include <SDL.h> | ||
23 | #include "button.h" | 25 | #include "button.h" |
26 | #include "buttonmap.h" | ||
24 | 27 | ||
25 | int key_to_button(int keyboard_key) | 28 | int key_to_button(int keyboard_key) |
26 | { | 29 | { |
27 | (void)keyboard_key; | 30 | int new_btn = BUTTON_NONE; |
28 | return BUTTON_NONE; | 31 | switch (keyboard_key) |
32 | { | ||
33 | case SDLK_KP7: | ||
34 | new_btn = BUTTON_TOPLEFT; | ||
35 | break; | ||
36 | case SDLK_KP8: | ||
37 | new_btn = BUTTON_TOPMIDDLE; | ||
38 | break; | ||
39 | case SDLK_KP9: | ||
40 | new_btn = BUTTON_TOPRIGHT; | ||
41 | break; | ||
42 | case SDLK_KP4: | ||
43 | case SDLK_LEFT: | ||
44 | new_btn = BUTTON_MIDLEFT; | ||
45 | break; | ||
46 | case SDLK_KP5: | ||
47 | new_btn = BUTTON_CENTER; | ||
48 | break; | ||
49 | case SDLK_KP6: | ||
50 | case SDLK_RIGHT: | ||
51 | new_btn = BUTTON_MIDRIGHT; | ||
52 | break; | ||
53 | case SDLK_KP1: | ||
54 | new_btn = BUTTON_BOTTOMLEFT; | ||
55 | break; | ||
56 | case SDLK_KP2: | ||
57 | case SDLK_DOWN: | ||
58 | new_btn = BUTTON_BOTTOMMIDDLE; | ||
59 | break; | ||
60 | case SDLK_KP3: | ||
61 | new_btn = BUTTON_BOTTOMRIGHT; | ||
62 | break; | ||
63 | #ifdef HAVE_SCROLLWHEEL | ||
64 | case SDL_BUTTON_WHEELUP: | ||
65 | new_btn = BUTTON_SCROLL_BACK; | ||
66 | break; | ||
67 | case SDL_BUTTON_WHEELDOWN: | ||
68 | new_btn = BUTTON_SCROLL_FWD; | ||
69 | break; | ||
70 | #endif | ||
71 | case SDL_BUTTON_RIGHT: | ||
72 | new_btn = BUTTON_MIDLEFT; | ||
73 | break; | ||
74 | case SDL_BUTTON_MIDDLE: | ||
75 | new_btn = BUTTON_MIDRIGHT; | ||
76 | break; | ||
77 | default: | ||
78 | break; | ||
79 | } | ||
80 | return new_btn; | ||
29 | } | 81 | } |
diff --git a/firmware/target/hosted/sdl/app/button-target.h b/firmware/target/hosted/sdl/app/button-target.h index 54ae3a2fae..5295315e2e 100644 --- a/firmware/target/hosted/sdl/app/button-target.h +++ b/firmware/target/hosted/sdl/app/button-target.h | |||
@@ -34,27 +34,26 @@ void button_init_device(void); | |||
34 | int button_read_device(int *data); | 34 | int button_read_device(int *data); |
35 | 35 | ||
36 | /* Main unit's buttons */ | 36 | /* Main unit's buttons */ |
37 | #define BUTTON_POWER 0x00000001 | 37 | #define BUTTON_UP 0x00000001 |
38 | #define BUTTON_PLUS 0x00000002 | 38 | #define BUTTON_DOWN 0x00000002 |
39 | #define BUTTON_MINUS 0x00000004 | 39 | #define BUTTON_LEFT 0x00000004 |
40 | #define BUTTON_MENU 0x00000008 | 40 | #define BUTTON_RIGHT 0x00000008 |
41 | 41 | #define BUTTON_SELECT 0x00000010 | |
42 | /* Compatibility hacks for flipping. Needs a somewhat better fix. */ | 42 | #define BUTTON_MENU 0x00000020 |
43 | #define BUTTON_LEFT BUTTON_MIDLEFT | 43 | #define BUTTON_BACK 0x00000040 |
44 | #define BUTTON_RIGHT BUTTON_MIDRIGHT | 44 | #define BUTTON_SCROLL_FWD 0x00000100 |
45 | #define BUTTON_UP BUTTON_TOPMIDDLE | 45 | #define BUTTON_SCROLL_BACK 0x00000200 |
46 | #define BUTTON_DOWN BUTTON_BOTTOMMIDDLE | ||
47 | 46 | ||
48 | /* Touch Screen Area Buttons */ | 47 | /* Touch Screen Area Buttons */ |
49 | #define BUTTON_TOPLEFT 0x00000010 | 48 | #define BUTTON_TOPLEFT 0x00001000 |
50 | #define BUTTON_TOPMIDDLE 0x00000020 | 49 | #define BUTTON_TOPMIDDLE 0x00002000 |
51 | #define BUTTON_TOPRIGHT 0x00000040 | 50 | #define BUTTON_TOPRIGHT 0x00004000 |
52 | #define BUTTON_MIDLEFT 0x00000080 | 51 | #define BUTTON_MIDLEFT 0x00008000 |
53 | #define BUTTON_CENTER 0x00000100 | 52 | #define BUTTON_CENTER 0x00010000 |
54 | #define BUTTON_MIDRIGHT 0x00000200 | 53 | #define BUTTON_MIDRIGHT 0x00020000 |
55 | #define BUTTON_BOTTOMLEFT 0x00000400 | 54 | #define BUTTON_BOTTOMLEFT 0x00040000 |
56 | #define BUTTON_BOTTOMMIDDLE 0x00000800 | 55 | #define BUTTON_BOTTOMMIDDLE 0x00080000 |
57 | #define BUTTON_BOTTOMRIGHT 0x00001000 | 56 | #define BUTTON_BOTTOMRIGHT 0x00100000 |
58 | 57 | ||
59 | #define BUTTON_MAIN 0x1FFF | 58 | #define BUTTON_MAIN 0x1FFF |
60 | 59 | ||
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index ee16e55fd1..519ac8d7c5 100644 --- a/firmware/target/hosted/sdl/button-sdl.c +++ b/firmware/target/hosted/sdl/button-sdl.c | |||
@@ -112,9 +112,16 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up) | |||
112 | if(button_up) { | 112 | if(button_up) { |
113 | switch ( event->button ) | 113 | switch ( event->button ) |
114 | { | 114 | { |
115 | #ifdef HAVE_SCROLLWHEEL | ||
116 | case SDL_BUTTON_WHEELUP: | ||
117 | case SDL_BUTTON_WHEELDOWN: | ||
118 | #endif | ||
119 | case SDL_BUTTON_MIDDLE: | ||
120 | case SDL_BUTTON_RIGHT: | ||
121 | button_event( event->button, false ); | ||
122 | break; | ||
115 | /* The scrollwheel button up events are ignored as they are queued immediately */ | 123 | /* The scrollwheel button up events are ignored as they are queued immediately */ |
116 | case SDL_BUTTON_LEFT: | 124 | case SDL_BUTTON_LEFT: |
117 | case SDL_BUTTON_MIDDLE: | ||
118 | if ( mapping && background ) { | 125 | if ( mapping && background ) { |
119 | printf(" { SDLK_, %d, %d, %d, \"\" },\n", x, y, | 126 | printf(" { SDLK_, %d, %d, %d, \"\" },\n", x, y, |
120 | (int)sqrt( SQUARE(x-(int)event->x) + SQUARE(y-(int)event->y)) | 127 | (int)sqrt( SQUARE(x-(int)event->x) + SQUARE(y-(int)event->y)) |
@@ -137,14 +144,13 @@ static void mouse_event(SDL_MouseButtonEvent *event, bool button_up) | |||
137 | { | 144 | { |
138 | #ifdef HAVE_SCROLLWHEEL | 145 | #ifdef HAVE_SCROLLWHEEL |
139 | case SDL_BUTTON_WHEELUP: | 146 | case SDL_BUTTON_WHEELUP: |
140 | button_event( SDLK_UP, true ); | ||
141 | break; | ||
142 | case SDL_BUTTON_WHEELDOWN: | 147 | case SDL_BUTTON_WHEELDOWN: |
143 | button_event( SDLK_DOWN, true ); | ||
144 | break; | ||
145 | #endif | 148 | #endif |
146 | case SDL_BUTTON_LEFT: | ||
147 | case SDL_BUTTON_MIDDLE: | 149 | case SDL_BUTTON_MIDDLE: |
150 | case SDL_BUTTON_RIGHT: | ||
151 | button_event( event->button, true ); | ||
152 | break; | ||
153 | case SDL_BUTTON_LEFT: | ||
148 | if ( mapping && background ) { | 154 | if ( mapping && background ) { |
149 | x = event->x; | 155 | x = event->x; |
150 | y = event->y; | 156 | y = event->y; |
diff --git a/firmware/target/hosted/sdl/key_to_touch-sdl.c b/firmware/target/hosted/sdl/key_to_touch-sdl.c index 90518c7c7e..a63df18ff5 100644 --- a/firmware/target/hosted/sdl/key_to_touch-sdl.c +++ b/firmware/target/hosted/sdl/key_to_touch-sdl.c | |||
@@ -51,6 +51,7 @@ int key_to_touch(int keyboard_button, unsigned int mouse_coords) | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | break; | 53 | break; |
54 | #ifndef CONFIG_PLATFORM | ||
54 | case SDLK_KP7: | 55 | case SDLK_KP7: |
55 | case SDLK_7: | 56 | case SDLK_7: |
56 | new_btn = BUTTON_TOPLEFT; | 57 | new_btn = BUTTON_TOPLEFT; |
@@ -58,6 +59,9 @@ int key_to_touch(int keyboard_button, unsigned int mouse_coords) | |||
58 | case SDLK_KP8: | 59 | case SDLK_KP8: |
59 | case SDLK_8: | 60 | case SDLK_8: |
60 | case SDLK_UP: | 61 | case SDLK_UP: |
62 | #ifdef HAVE_SCROLLWHEEL | ||
63 | case SDL_BUTTON_WHEELDOWN: | ||
64 | #endif | ||
61 | new_btn = BUTTON_TOPMIDDLE; | 65 | new_btn = BUTTON_TOPMIDDLE; |
62 | break; | 66 | break; |
63 | case SDLK_KP9: | 67 | case SDLK_KP9: |
@@ -71,6 +75,7 @@ int key_to_touch(int keyboard_button, unsigned int mouse_coords) | |||
71 | break; | 75 | break; |
72 | case SDLK_KP5: | 76 | case SDLK_KP5: |
73 | case SDLK_i: | 77 | case SDLK_i: |
78 | case SDL_BUTTON_MIDDLE: | ||
74 | new_btn = BUTTON_CENTER; | 79 | new_btn = BUTTON_CENTER; |
75 | break; | 80 | break; |
76 | case SDLK_KP6: | 81 | case SDLK_KP6: |
@@ -84,6 +89,9 @@ int key_to_touch(int keyboard_button, unsigned int mouse_coords) | |||
84 | break; | 89 | break; |
85 | case SDLK_KP2: | 90 | case SDLK_KP2: |
86 | case SDLK_k: | 91 | case SDLK_k: |
92 | #ifdef HAVE_SCROLLWHEEL | ||
93 | case SDL_BUTTON_WHEELDOWN: | ||
94 | #endif | ||
87 | case SDLK_DOWN: | 95 | case SDLK_DOWN: |
88 | new_btn = BUTTON_BOTTOMMIDDLE; | 96 | new_btn = BUTTON_BOTTOMMIDDLE; |
89 | break; | 97 | break; |
@@ -91,6 +99,7 @@ int key_to_touch(int keyboard_button, unsigned int mouse_coords) | |||
91 | case SDLK_l: | 99 | case SDLK_l: |
92 | new_btn = BUTTON_BOTTOMRIGHT; | 100 | new_btn = BUTTON_BOTTOMRIGHT; |
93 | break; | 101 | break; |
102 | #endif | ||
94 | } | 103 | } |
95 | return new_btn; | 104 | return new_btn; |
96 | } | 105 | } |
diff --git a/uisimulator/buttonmap/ipod.c b/uisimulator/buttonmap/ipod.c index 504b77b8dd..1fc95d8dd1 100644 --- a/uisimulator/buttonmap/ipod.c +++ b/uisimulator/buttonmap/ipod.c | |||
@@ -58,6 +58,12 @@ int key_to_button(int keyboard_button) | |||
58 | case SDLK_INSERT: | 58 | case SDLK_INSERT: |
59 | new_btn = BUTTON_MENU; | 59 | new_btn = BUTTON_MENU; |
60 | break; | 60 | break; |
61 | case SDL_BUTTON_WHEELUP: | ||
62 | new_btn = BUTTON_SCROLL_BACK; | ||
63 | break; | ||
64 | case SDL_BUTTON_WHEELDOWN: | ||
65 | new_btn = BUTTON_SCROLL_FWD; | ||
66 | break; | ||
61 | } | 67 | } |
62 | return new_btn; | 68 | return new_btn; |
63 | } | 69 | } |
diff --git a/uisimulator/buttonmap/sansa-e200.c b/uisimulator/buttonmap/sansa-e200.c index 66655e26c5..b9a872caa1 100644 --- a/uisimulator/buttonmap/sansa-e200.c +++ b/uisimulator/buttonmap/sansa-e200.c | |||
@@ -65,6 +65,12 @@ int key_to_button(int keyboard_button) | |||
65 | case SDLK_SPACE: | 65 | case SDLK_SPACE: |
66 | new_btn = BUTTON_SELECT; | 66 | new_btn = BUTTON_SELECT; |
67 | break; | 67 | break; |
68 | case SDL_BUTTON_WHEELUP: | ||
69 | new_btn = BUTTON_SCROLL_BACK; | ||
70 | break; | ||
71 | case SDL_BUTTON_WHEELDOWN: | ||
72 | new_btn = BUTTON_SCROLL_FWD; | ||
73 | break; | ||
68 | } | 74 | } |
69 | return new_btn; | 75 | return new_btn; |
70 | } | 76 | } |
diff --git a/uisimulator/buttonmap/sansa-fuze.c b/uisimulator/buttonmap/sansa-fuze.c index 2788af5d51..fcd935946e 100644 --- a/uisimulator/buttonmap/sansa-fuze.c +++ b/uisimulator/buttonmap/sansa-fuze.c | |||
@@ -66,6 +66,12 @@ int key_to_button(int keyboard_button) | |||
66 | case SDLK_RETURN: | 66 | case SDLK_RETURN: |
67 | new_btn = BUTTON_SELECT; | 67 | new_btn = BUTTON_SELECT; |
68 | break; | 68 | break; |
69 | case SDL_BUTTON_WHEELUP: | ||
70 | new_btn = BUTTON_SCROLL_BACK; | ||
71 | break; | ||
72 | case SDL_BUTTON_WHEELDOWN: | ||
73 | new_btn = BUTTON_SCROLL_FWD; | ||
74 | break; | ||
69 | } | 75 | } |
70 | return new_btn; | 76 | return new_btn; |
71 | } | 77 | } |