Changeset 9db4079 in mainline for uspace/srv/kbd/layout/us_qwerty.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_qwerty.c

    rb27eb71 r9db4079  
    3737#include <layout.h>
    3838
    39 static char map_lcase[] = {
     39static wchar_t map_lcase[] = {
    4040        [KC_Q] = 'q',
    4141        [KC_W] = 'w',
     
    6868};
    6969
    70 static char map_ucase[] = {
     70static wchar_t map_ucase[] = {
    7171        [KC_Q] = 'Q',
    7272        [KC_W] = 'W',
     
    9999};
    100100
    101 static char map_not_shifted[] = {
     101static wchar_t map_not_shifted[] = {
    102102        [KC_BACKTICK] = '`',
    103103
     
    128128};
    129129
    130 static char map_shifted[] = {
     130static wchar_t map_shifted[] = {
    131131        [KC_BACKTICK] = '~',
    132132
     
    157157};
    158158
    159 static char map_neutral[] = {
     159static wchar_t map_neutral[] = {
    160160        [KC_BACKSPACE] = '\b',
    161161        [KC_TAB] = '\t',
     
    170170};
    171171
    172 static char map_numeric[] = {
     172static wchar_t map_numeric[] = {
    173173        [KC_N7] = '7',
    174174        [KC_N8] = '8',
     
    185185};
    186186
    187 static int translate(unsigned int key, char *map, size_t map_length)
     187static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
    188188{
    189         if (key >= map_length) return 0;
    190         return map[key];       
     189        if (key >= map_length)
     190                return 0;
     191        return map[key];
    191192}
    192193
    193 char layout_parse_ev(kbd_event_t *ev)
     194wchar_t layout_parse_ev(kbd_event_t *ev)
    194195{
    195         char c;
     196        wchar_t c;
    196197
    197198        /* Produce no characters when Ctrl or Alt is pressed. */
     
    199200                return 0;
    200201
    201         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
    202         if (c != 0) return c;
     202        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
     203        if (c != 0)
     204                return c;
    203205
    204206        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    205                 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
     207                c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t));
    206208        else
    207                 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
    208 
    209         if (c != 0) return c;
     209                c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t));
     210
     211        if (c != 0)
     212                return c;
    210213
    211214        if ((ev->mods & KM_SHIFT) != 0)
    212                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
     215                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
    213216        else
    214                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
    215 
    216         if (c != 0) return c;
     217                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
     218
     219        if (c != 0)
     220                return c;
    217221
    218222        if ((ev->mods & KM_NUM_LOCK) != 0)
    219                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
     223                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
    220224        else
    221225                c = 0;
Note: See TracChangeset for help on using the changeset viewer.