Changeset 9db4079 in mainline for uspace/srv/kbd/layout/us_dvorak.c


Ignore:
Timestamp:
2009-04-05T09:27:12Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cee8d3e
Parents:
b27eb71
Message:

UCS in keyboard driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/kbd/layout/us_dvorak.c

    rb27eb71 r9db4079  
    3737#include <layout.h>
    3838
    39 static char map_lcase[] = {
     39static wchar_t map_lcase[] = {
    4040        [KC_R] = 'p',
    4141        [KC_T] = 'y',
     
    7070};
    7171
    72 static char map_ucase[] = {
     72static wchar_t map_ucase[] = {
    7373        [KC_R] = 'P',
    7474        [KC_T] = 'Y',
     
    103103};
    104104
    105 static char map_not_shifted[] = {
     105static wchar_t map_not_shifted[] = {
    106106        [KC_BACKTICK] = '`',
    107107
     
    133133};
    134134
    135 static char map_shifted[] = {
     135static wchar_t map_shifted[] = {
    136136        [KC_BACKTICK] = '~',
    137137
     
    163163};
    164164
    165 static char map_neutral[] = {
     165static wchar_t map_neutral[] = {
    166166        [KC_BACKSPACE] = '\b',
    167167        [KC_TAB] = '\t',
     
    176176};
    177177
    178 static char map_numeric[] = {
     178static wchar_t map_numeric[] = {
    179179        [KC_N7] = '7',
    180180        [KC_N8] = '8',
     
    191191};
    192192
    193 static int translate(unsigned int key, char *map, size_t map_length)
     193static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
    194194{
    195195        if (key >= map_length)
     
    198198}
    199199
    200 char layout_parse_ev(kbd_event_t *ev)
     200wchar_t layout_parse_ev(kbd_event_t *ev)
    201201{
    202         char c;
     202        wchar_t c;
    203203
    204204        /* Produce no characters when Ctrl or Alt is pressed. */
     
    206206                return 0;
    207207
    208         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
     208        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
    209209        if (c != 0)
    210210                return c;
    211211
    212212        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    213                 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
     213                c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t));
    214214        else
    215                 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
     215                c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t));
    216216
    217217        if (c != 0)
     
    219219
    220220        if ((ev->mods & KM_SHIFT) != 0)
    221                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
     221                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
    222222        else
    223                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
     223                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
    224224
    225225        if (c != 0)
     
    227227
    228228        if ((ev->mods & KM_NUM_LOCK) != 0)
    229                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
     229                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
    230230        else
    231231                c = 0;
Note: See TracChangeset for help on using the changeset viewer.