27,9 → 27,9 |
*/ |
|
/** @addtogroup kbd |
* @brief US Dvorak Simplified Keyboard layout. |
* @brief US Dvorak Simplified Keyboard layout. |
* @{ |
*/ |
*/ |
|
#include <kbd.h> |
#include <kbd/kbd.h> |
165,13 → 165,36 |
static char map_neutral[] = { |
[KC_BACKSPACE] = '\b', |
[KC_TAB] = '\t', |
[KC_ENTER] = '\n' |
[KC_ENTER] = '\n', |
[KC_SPACE] = ' ', |
|
[KC_NSLASH] = '/', |
[KC_NTIMES] = '*', |
[KC_NMINUS] = '-', |
[KC_NPLUS] = '+', |
[KC_NENTER] = '\n' |
}; |
|
static char map_numeric[] = { |
[KC_N7] = '7', |
[KC_N8] = '8', |
[KC_N9] = '9', |
[KC_N4] = '4', |
[KC_N5] = '5', |
[KC_N6] = '6', |
[KC_N1] = '1', |
[KC_N2] = '2', |
[KC_N3] = '3', |
|
[KC_N0] = '0', |
[KC_NPERIOD] = '.' |
}; |
|
static int translate(unsigned int key, char *map, size_t map_length) |
{ |
if (key >= map_length) return 0; |
return map[key]; |
if (key >= map_length) |
return 0; |
return map[key]; |
} |
|
char layout_parse_ev(kbd_event_t *ev) |
183,7 → 206,8 |
return 0; |
|
c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char)); |
if (c != 0) return c; |
if (c != 0) |
return c; |
|
if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0)) |
c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char)); |
190,7 → 214,8 |
else |
c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char)); |
|
if (c != 0) return c; |
if (c != 0) |
return c; |
|
if ((ev->mods & KM_SHIFT) != 0) |
c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char)); |
197,11 → 222,17 |
else |
c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char)); |
|
if (c != 0 ) return c; |
if (c != 0) |
return c; |
|
if ((ev->mods & KM_NUM_LOCK) != 0) |
c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char)); |
else |
c = 0; |
|
return c; |
} |
|
|
/** |
* @} |
*/ |
*/ |