Rev 3933 | Rev 4236 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3933 | Rev 3942 | ||
|---|---|---|---|
| Line 158... | Line 158... | ||
| 158 | 158 | ||
| 159 | static char map_neutral[] = { |
159 | static char map_neutral[] = { |
| 160 | [KC_BACKSPACE] = '\b', |
160 | [KC_BACKSPACE] = '\b', |
| 161 | [KC_TAB] = '\t', |
161 | [KC_TAB] = '\t', |
| 162 | [KC_ENTER] = '\n', |
162 | [KC_ENTER] = '\n', |
| 163 | [KC_SPACE] = ' ' |
163 | [KC_SPACE] = ' ', |
| - | 164 | ||
| - | 165 | [KC_NSLASH] = '/', |
|
| - | 166 | [KC_NTIMES] = '*', |
|
| - | 167 | [KC_NMINUS] = '-', |
|
| - | 168 | [KC_NPLUS] = '+', |
|
| - | 169 | [KC_NENTER] = '\n' |
|
| - | 170 | }; |
|
| - | 171 | ||
| - | 172 | static char map_numeric[] = { |
|
| - | 173 | [KC_N7] = '7', |
|
| - | 174 | [KC_N8] = '8', |
|
| - | 175 | [KC_N9] = '9', |
|
| - | 176 | [KC_N4] = '4', |
|
| - | 177 | [KC_N5] = '5', |
|
| - | 178 | [KC_N6] = '6', |
|
| - | 179 | [KC_N1] = '1', |
|
| - | 180 | [KC_N2] = '2', |
|
| - | 181 | [KC_N3] = '3', |
|
| - | 182 | ||
| - | 183 | [KC_N0] = '0', |
|
| - | 184 | [KC_NPERIOD] = '.' |
|
| 164 | }; |
185 | }; |
| 165 | 186 | ||
| 166 | static int translate(unsigned int key, char *map, size_t map_length) |
187 | static int translate(unsigned int key, char *map, size_t map_length) |
| 167 | { |
188 | { |
| 168 | if (key >= map_length) return 0; |
189 | if (key >= map_length) return 0; |
| Line 190... | Line 211... | ||
| 190 | if ((ev->mods & KM_SHIFT) != 0) |
211 | if ((ev->mods & KM_SHIFT) != 0) |
| 191 | c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char)); |
212 | c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char)); |
| 192 | else |
213 | else |
| 193 | c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char)); |
214 | c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char)); |
| 194 | 215 | ||
| 195 | if (c != 0 ) return c; |
216 | if (c != 0) return c; |
| - | 217 | ||
| - | 218 | if ((ev->mods & KM_NUM_LOCK) != 0) |
|
| - | 219 | c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char)); |
|
| - | 220 | else |
|
| - | 221 | c = 0; |
|
| 196 | 222 | ||
| - | 223 | return c; |
|
| 197 | } |
224 | } |
| 198 | 225 | ||
| 199 | /** |
226 | /** |
| 200 | * @} |
227 | * @} |
| 201 | */ |
228 | */ |