Changeset 28a5ebd in mainline for uspace/srv/hid


Ignore:
Timestamp:
2020-06-18T15:39:50Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce52c333
Parents:
4f663f3e
Message:

Use char32_t instead of wchat_t to represent UTF-32 strings

The intention of the native HelenOS string API has been always to
support Unicode in the UTF-8 and UTF-32 encodings as the sole character
representations and ignore the obsolete mess of older single-byte and
multibyte character encodings. Before C11, the wchar_t type has been
slightly misused for the purpose of the UTF-32 strings. The newer
char32_t type is obviously a much more suitable option. The standard
defines char32_t as uint_least32_t, thus we can take the liberty to fix
it to uint32_t.

To maintain compatilibity with the C Standard, the putwchar(wchar_t)
functions has been replaced by our custom putuchar(char32_t) functions
where appropriate.

Location:
uspace/srv/hid
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/compositor/compositor.c

    r4f663f3e r28a5ebd  
    156156static errno_t comp_active(input_t *);
    157157static errno_t comp_deactive(input_t *);
    158 static errno_t comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
     158static errno_t comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    159159static errno_t comp_mouse_move(input_t *, int, int);
    160160static errno_t comp_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
     
    18631863
    18641864static errno_t comp_key_press(input_t *input, kbd_event_type_t type, keycode_t key,
    1865     keymod_t mods, wchar_t c)
     1865    keymod_t mods, char32_t c)
    18661866{
    18671867        bool win_transform = (mods & KM_ALT) &&
  • uspace/srv/hid/console/console.c

    r4f663f3e r28a5ebd  
    105105static errno_t input_ev_active(input_t *);
    106106static errno_t input_ev_deactive(input_t *);
    107 static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
     107static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    108108static errno_t input_ev_move(input_t *, int, int);
    109109static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
     
    250250
    251251static errno_t input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
    252     keymod_t mods, wchar_t c)
     252    keymod_t mods, char32_t c)
    253253{
    254254        if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) &&
     
    293293
    294294/** Process a character from the client (TTY emulation). */
    295 static void cons_write_char(console_t *cons, wchar_t ch)
     295static void cons_write_char(console_t *cons, char32_t ch)
    296296{
    297297        sysarg_t updated = 0;
     
    312312                break;
    313313        default:
    314                 updated = chargrid_putwchar(cons->frontbuf, ch, true);
     314                updated = chargrid_putuchar(cons->frontbuf, ch, true);
    315315        }
    316316
     
    371371                        /* Accept key presses of printable chars only. */
    372372                        if ((event->type == KEY_PRESS) && (event->c != 0)) {
    373                                 wchar_t tmp[2] = { event->c, 0 };
     373                                char32_t tmp[2] = { event->c, 0 };
    374374                                wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp);
    375375                                cons->char_remains_len = str_size(cons->char_remains);
  • uspace/srv/hid/input/layout.c

    r4f663f3e r28a5ebd  
    6969
    7070/** Parse keyboard event. */
    71 wchar_t layout_parse_ev(layout_t *layout, kbd_event_t *ev)
     71char32_t layout_parse_ev(layout_t *layout, kbd_event_t *ev)
    7272{
    7373        return (*layout->ops->parse_ev)(layout, ev);
  • uspace/srv/hid/input/layout.h

    r4f663f3e r28a5ebd  
    5353        errno_t (*create)(layout_t *);
    5454        void (*destroy)(layout_t *);
    55         wchar_t (*parse_ev)(layout_t *, kbd_event_t *);
     55        char32_t (*parse_ev)(layout_t *, kbd_event_t *);
    5656} layout_ops_t;
    5757
     
    6464extern layout_t *layout_create(layout_ops_t *);
    6565extern void layout_destroy(layout_t *);
    66 extern wchar_t layout_parse_ev(layout_t *, kbd_event_t *);
     66extern char32_t layout_parse_ev(layout_t *, kbd_event_t *);
    6767
    6868#endif
  • uspace/srv/hid/input/layout/ar.c

    r4f663f3e r28a5ebd  
    4444static errno_t ar_create(layout_t *);
    4545static void ar_destroy(layout_t *);
    46 static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);
     46static char32_t ar_parse_ev(layout_t *, kbd_event_t *ev);
    4747
    4848layout_ops_t ar_ops = {
     
    5252};
    5353
    54 static wchar_t map_not_shifted[] = {
     54static char32_t map_not_shifted[] = {
    5555        [KC_BACKTICK] = L'ذ',
    5656
     
    110110};
    111111
    112 static wchar_t map_shifted[] = {
     112static char32_t map_shifted[] = {
    113113        [KC_BACKTICK] = L'ّ',
    114114
     
    168168};
    169169
    170 static wchar_t map_neutral[] = {
     170static char32_t map_neutral[] = {
    171171        [KC_BACKSPACE] = '\b',
    172172        [KC_TAB] = '\t',
     
    181181};
    182182
    183 static wchar_t map_numeric[] = {
     183static char32_t map_numeric[] = {
    184184        [KC_N7] = '7',
    185185        [KC_N8] = '8',
     
    196196};
    197197
    198 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
     198static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
    199199{
    200200        if (key >= map_length)
     
    212212}
    213213
    214 static wchar_t ar_parse_ev(layout_t *state, kbd_event_t *ev)
    215 {
    216         wchar_t c;
     214static char32_t ar_parse_ev(layout_t *state, kbd_event_t *ev)
     215{
     216        char32_t c;
    217217
    218218        /* Produce no characters when Ctrl or Alt is pressed. */
     
    220220                return 0;
    221221
    222         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
     222        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
    223223        if (c != 0)
    224224                return c;
    225225
    226226        if ((ev->mods & KM_SHIFT) != 0)
    227                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
     227                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
    228228        else
    229                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
     229                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
    230230
    231231        if (c != 0)
     
    233233
    234234        if ((ev->mods & KM_NUM_LOCK) != 0)
    235                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
     235                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
    236236        else
    237237                c = 0;
  • uspace/srv/hid/input/layout/cz.c

    r4f663f3e r28a5ebd  
    4545static errno_t cz_create(layout_t *);
    4646static void cz_destroy(layout_t *);
    47 static wchar_t cz_parse_ev(layout_t *, kbd_event_t *ev);
     47static char32_t cz_parse_ev(layout_t *, kbd_event_t *ev);
    4848
    4949enum m_state {
     
    6363};
    6464
    65 static wchar_t map_lcase[] = {
     65static char32_t map_lcase[] = {
    6666        [KC_Q] = 'q',
    6767        [KC_W] = 'w',
     
    9494};
    9595
    96 static wchar_t map_ucase[] = {
     96static char32_t map_ucase[] = {
    9797        [KC_Q] = 'Q',
    9898        [KC_W] = 'W',
     
    125125};
    126126
    127 static wchar_t map_not_shifted[] = {
     127static char32_t map_not_shifted[] = {
    128128        [KC_BACKTICK] = ';',
    129129
     
    141141};
    142142
    143 static wchar_t map_shifted[] = {
     143static char32_t map_shifted[] = {
    144144        [KC_1] = '1',
    145145        [KC_2] = '2',
     
    167167};
    168168
    169 static wchar_t map_ns_nocaps[] = {
     169static char32_t map_ns_nocaps[] = {
    170170        [KC_2] = L'ě',
    171171        [KC_3] = L'š',
     
    182182};
    183183
    184 static wchar_t map_ns_caps[] = {
     184static char32_t map_ns_caps[] = {
    185185        [KC_2] = L'Ě',
    186186        [KC_3] = L'Š',
     
    197197};
    198198
    199 static wchar_t map_neutral[] = {
     199static char32_t map_neutral[] = {
    200200        [KC_BACKSPACE] = '\b',
    201201        [KC_TAB] = '\t',
     
    210210};
    211211
    212 static wchar_t map_numeric[] = {
     212static char32_t map_numeric[] = {
    213213        [KC_N7] = '7',
    214214        [KC_N8] = '8',
     
    225225};
    226226
    227 static wchar_t map_hacek_lcase[] = {
     227static char32_t map_hacek_lcase[] = {
    228228        [KC_E] = L'ě',
    229229        [KC_R] = L'ř',
     
    239239};
    240240
    241 static wchar_t map_hacek_ucase[] = {
     241static char32_t map_hacek_ucase[] = {
    242242        [KC_E] = L'Ě',
    243243        [KC_R] = L'Ř',
     
    253253};
    254254
    255 static wchar_t map_carka_lcase[] = {
     255static char32_t map_carka_lcase[] = {
    256256        [KC_E] = L'é',
    257257        [KC_U] = L'ú',
     
    264264};
    265265
    266 static wchar_t map_carka_ucase[] = {
     266static char32_t map_carka_ucase[] = {
    267267        [KC_E] = L'É',
    268268        [KC_U] = L'Ú',
     
    275275};
    276276
    277 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
     277static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
    278278{
    279279        if (key >= map_length)
     
    282282}
    283283
    284 static wchar_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev)
    285 {
    286         wchar_t c;
     284static char32_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev)
     285{
     286        char32_t c;
    287287
    288288        cz_state->mstate = ms_start;
     
    293293
    294294        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    295                 c = translate(ev->key, map_hacek_ucase, sizeof(map_hacek_ucase) / sizeof(wchar_t));
     295                c = translate(ev->key, map_hacek_ucase, sizeof(map_hacek_ucase) / sizeof(char32_t));
    296296        else
    297                 c = translate(ev->key, map_hacek_lcase, sizeof(map_hacek_lcase) / sizeof(wchar_t));
     297                c = translate(ev->key, map_hacek_lcase, sizeof(map_hacek_lcase) / sizeof(char32_t));
    298298
    299299        return c;
    300300}
    301301
    302 static wchar_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev)
    303 {
    304         wchar_t c;
     302static char32_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev)
     303{
     304        char32_t c;
    305305
    306306        cz_state->mstate = ms_start;
     
    311311
    312312        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    313                 c = translate(ev->key, map_carka_ucase, sizeof(map_carka_ucase) / sizeof(wchar_t));
     313                c = translate(ev->key, map_carka_ucase, sizeof(map_carka_ucase) / sizeof(char32_t));
    314314        else
    315                 c = translate(ev->key, map_carka_lcase, sizeof(map_carka_lcase) / sizeof(wchar_t));
     315                c = translate(ev->key, map_carka_lcase, sizeof(map_carka_lcase) / sizeof(char32_t));
    316316
    317317        return c;
    318318}
    319319
    320 static wchar_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev)
    321 {
    322         wchar_t c;
     320static char32_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev)
     321{
     322        char32_t c;
    323323
    324324        /* Produce no characters when Ctrl or Alt is pressed. */
     
    335335        }
    336336
    337         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
     337        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
    338338        if (c != 0)
    339339                return c;
     
    341341        if ((ev->mods & KM_SHIFT) == 0) {
    342342                if ((ev->mods & KM_CAPS_LOCK) != 0)
    343                         c = translate(ev->key, map_ns_caps, sizeof(map_ns_caps) / sizeof(wchar_t));
     343                        c = translate(ev->key, map_ns_caps, sizeof(map_ns_caps) / sizeof(char32_t));
    344344                else
    345                         c = translate(ev->key, map_ns_nocaps, sizeof(map_ns_nocaps) / sizeof(wchar_t));
     345                        c = translate(ev->key, map_ns_nocaps, sizeof(map_ns_nocaps) / sizeof(char32_t));
    346346
    347347                if (c != 0)
     
    350350
    351351        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    352                 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t));
     352                c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
    353353        else
    354                 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t));
     354                c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
    355355
    356356        if (c != 0)
     
    358358
    359359        if ((ev->mods & KM_SHIFT) != 0)
    360                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
     360                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
    361361        else
    362                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
     362                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
    363363
    364364        if (c != 0)
     
    366366
    367367        if ((ev->mods & KM_NUM_LOCK) != 0)
    368                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
     368                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
    369369        else
    370370                c = 0;
     
    409409}
    410410
    411 static wchar_t cz_parse_ev(layout_t *state, kbd_event_t *ev)
     411static char32_t cz_parse_ev(layout_t *state, kbd_event_t *ev)
    412412{
    413413        layout_cz_t *cz_state = (layout_cz_t *) state->layout_priv;
  • uspace/srv/hid/input/layout/fr_azerty.c

    r4f663f3e r28a5ebd  
    4343static errno_t fr_azerty_create (layout_t *);
    4444static void fr_azerty_destroy (layout_t *);
    45 static wchar_t fr_azerty_parse_ev (layout_t *, kbd_event_t *);
     45static char32_t fr_azerty_parse_ev (layout_t *, kbd_event_t *);
    4646
    4747layout_ops_t fr_azerty_ops = {
     
    5151};
    5252
    53 static wchar_t map_lcase[] = {
     53static char32_t map_lcase[] = {
    5454        [KC_Q] = 'a',
    5555        [KC_W] = 'z',
     
    8282};
    8383
    84 static wchar_t map_ucase[] = {
     84static char32_t map_ucase[] = {
    8585        [KC_Q] = 'A',
    8686        [KC_W] = 'Z',
     
    117117};
    118118
    119 static wchar_t map_not_shifted[] = {
     119static char32_t map_not_shifted[] = {
    120120        [KC_BACKTICK] = L'²',
    121121
     
    146146};
    147147
    148 static wchar_t map_shifted[] = {
     148static char32_t map_shifted[] = {
    149149        [KC_M] = '?',
    150150        [KC_BACKTICK] = '~',
     
    176176};
    177177
    178 static wchar_t map_neutral[] = {
     178static char32_t map_neutral[] = {
    179179        [KC_BACKSPACE] = '\b',
    180180        [KC_TAB] = '\t',
     
    189189};
    190190
    191 static wchar_t map_numeric[] = {
     191static char32_t map_numeric[] = {
    192192        [KC_N7] = '7',
    193193        [KC_N8] = '8',
     
    204204};
    205205
    206 static wchar_t translate (unsigned int key, wchar_t *map, size_t map_len)
     206static char32_t translate (unsigned int key, char32_t *map, size_t map_len)
    207207{
    208208        if (key >= map_len)
     
    221221}
    222222
    223 static wchar_t fr_azerty_parse_ev (layout_t *s, kbd_event_t *e)
     223static char32_t fr_azerty_parse_ev (layout_t *s, kbd_event_t *e)
    224224{
    225225        if ((e->mods & (KM_CTRL | KM_ALT)))
    226226                return 0; // Produce no characters when Ctrl or Alt is pressed
    227227
    228         wchar_t c = translate (e->key, map_neutral, sizeof (map_neutral) / sizeof (wchar_t));
     228        char32_t c = translate (e->key, map_neutral, sizeof (map_neutral) / sizeof (char32_t));
    229229        if (c)
    230230                return c;
    231231
    232232        if ((e->mods & KM_SHIFT))
    233                 c = translate (e->key, map_shifted, sizeof (map_shifted) / sizeof (wchar_t));
     233                c = translate (e->key, map_shifted, sizeof (map_shifted) / sizeof (char32_t));
    234234        else
    235                 c = translate (e->key, map_not_shifted, sizeof (map_not_shifted) / sizeof (wchar_t));
     235                c = translate (e->key, map_not_shifted, sizeof (map_not_shifted) / sizeof (char32_t));
    236236
    237237        if (c)
     
    239239
    240240        if (((e->mods & KM_SHIFT)) ^ ((e->mods & KM_CAPS_LOCK)))
    241                 c = translate (e->key, map_ucase, sizeof (map_ucase) / sizeof (wchar_t));
     241                c = translate (e->key, map_ucase, sizeof (map_ucase) / sizeof (char32_t));
    242242        else
    243                 c = translate (e->key, map_lcase, sizeof (map_lcase) / sizeof (wchar_t));
     243                c = translate (e->key, map_lcase, sizeof (map_lcase) / sizeof (char32_t));
    244244
    245245        if (c)
     
    247247
    248248        if ((e->mods & KM_NUM_LOCK))
    249                 c = translate (e->key, map_numeric, sizeof (map_numeric) / sizeof (wchar_t));
     249                c = translate (e->key, map_numeric, sizeof (map_numeric) / sizeof (char32_t));
    250250        else
    251251                c = 0;
  • uspace/srv/hid/input/layout/us_dvorak.c

    r4f663f3e r28a5ebd  
    4343static errno_t us_dvorak_create(layout_t *);
    4444static void us_dvorak_destroy(layout_t *);
    45 static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
     45static char32_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
    4646
    4747layout_ops_t us_dvorak_ops = {
     
    5151};
    5252
    53 static wchar_t map_lcase[] = {
     53static char32_t map_lcase[] = {
    5454        [KC_R] = 'p',
    5555        [KC_T] = 'y',
     
    8484};
    8585
    86 static wchar_t map_ucase[] = {
     86static char32_t map_ucase[] = {
    8787        [KC_R] = 'P',
    8888        [KC_T] = 'Y',
     
    117117};
    118118
    119 static wchar_t map_not_shifted[] = {
     119static char32_t map_not_shifted[] = {
    120120        [KC_BACKTICK] = '`',
    121121
     
    147147};
    148148
    149 static wchar_t map_shifted[] = {
     149static char32_t map_shifted[] = {
    150150        [KC_BACKTICK] = '~',
    151151
     
    177177};
    178178
    179 static wchar_t map_neutral[] = {
     179static char32_t map_neutral[] = {
    180180        [KC_BACKSPACE] = '\b',
    181181        [KC_TAB] = '\t',
     
    190190};
    191191
    192 static wchar_t map_numeric[] = {
     192static char32_t map_numeric[] = {
    193193        [KC_N7] = '7',
    194194        [KC_N8] = '8',
     
    205205};
    206206
    207 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
     207static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
    208208{
    209209        if (key >= map_length)
     
    221221}
    222222
    223 static wchar_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev)
    224 {
    225         wchar_t c;
     223static char32_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev)
     224{
     225        char32_t c;
    226226
    227227        /* Produce no characters when Ctrl or Alt is pressed. */
     
    229229                return 0;
    230230
    231         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
     231        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
    232232        if (c != 0)
    233233                return c;
    234234
    235235        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    236                 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t));
     236                c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
    237237        else
    238                 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t));
     238                c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
    239239
    240240        if (c != 0)
     
    242242
    243243        if ((ev->mods & KM_SHIFT) != 0)
    244                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
     244                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
    245245        else
    246                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
     246                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
    247247
    248248        if (c != 0)
     
    250250
    251251        if ((ev->mods & KM_NUM_LOCK) != 0)
    252                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
     252                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
    253253        else
    254254                c = 0;
  • uspace/srv/hid/input/layout/us_qwerty.c

    r4f663f3e r28a5ebd  
    4343static errno_t us_qwerty_create(layout_t *);
    4444static void us_qwerty_destroy(layout_t *);
    45 static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
     45static char32_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
    4646
    4747layout_ops_t us_qwerty_ops = {
     
    5151};
    5252
    53 static wchar_t map_lcase[] = {
     53static char32_t map_lcase[] = {
    5454        [KC_Q] = 'q',
    5555        [KC_W] = 'w',
     
    8282};
    8383
    84 static wchar_t map_ucase[] = {
     84static char32_t map_ucase[] = {
    8585        [KC_Q] = 'Q',
    8686        [KC_W] = 'W',
     
    113113};
    114114
    115 static wchar_t map_not_shifted[] = {
     115static char32_t map_not_shifted[] = {
    116116        [KC_BACKTICK] = '`',
    117117
     
    142142};
    143143
    144 static wchar_t map_shifted[] = {
     144static char32_t map_shifted[] = {
    145145        [KC_BACKTICK] = '~',
    146146
     
    171171};
    172172
    173 static wchar_t map_neutral[] = {
     173static char32_t map_neutral[] = {
    174174        [KC_BACKSPACE] = '\b',
    175175        [KC_TAB] = '\t',
     
    184184};
    185185
    186 static wchar_t map_numeric[] = {
     186static char32_t map_numeric[] = {
    187187        [KC_N7] = '7',
    188188        [KC_N8] = '8',
     
    199199};
    200200
    201 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)
     201static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
    202202{
    203203        if (key >= map_length)
     
    215215}
    216216
    217 static wchar_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev)
    218 {
    219         wchar_t c;
     217static char32_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev)
     218{
     219        char32_t c;
    220220
    221221        /* Produce no characters when Ctrl or Alt is pressed. */
     
    223223                return 0;
    224224
    225         c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t));
     225        c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
    226226        if (c != 0)
    227227                return c;
    228228
    229229        if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
    230                 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t));
     230                c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
    231231        else
    232                 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t));
     232                c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
    233233
    234234        if (c != 0)
     
    236236
    237237        if ((ev->mods & KM_SHIFT) != 0)
    238                 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t));
     238                c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
    239239        else
    240                 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t));
     240                c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
    241241
    242242        if (c != 0)
     
    244244
    245245        if ((ev->mods & KM_NUM_LOCK) != 0)
    246                 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t));
     246                c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
    247247        else
    248248                c = 0;
  • uspace/srv/hid/output/ctl/serial.c

    r4f663f3e r28a5ebd  
    5757        vt100_goto(state, col, row);
    5858        vt100_set_attr(state, field->attrs);
    59         vt100_putwchar(state, field->ch);
     59        vt100_putuchar(state, field->ch);
    6060}
    6161
     
    122122};
    123123
    124 errno_t serial_init(vt100_putwchar_t putwchar_fn,
     124errno_t serial_init(vt100_putuchar_t putuchar_fn,
    125125    vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn)
    126126{
    127127        vt100_state_t *state =
    128             vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putwchar_fn,
     128            vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putuchar_fn,
    129129            control_puts_fn, flush_fn);
    130130        if (state == NULL)
  • uspace/srv/hid/output/ctl/serial.h

    r4f663f3e r28a5ebd  
    3737#include "../proto/vt100.h"
    3838
    39 extern errno_t serial_init(vt100_putwchar_t, vt100_control_puts_t, vt100_flush_t);
     39extern errno_t serial_init(vt100_putuchar_t, vt100_control_puts_t, vt100_flush_t);
    4040
    4141#endif
  • uspace/srv/hid/output/gfx/font-8x16.c

    r4f663f3e r28a5ebd  
    4545 *
    4646 */
    47 uint16_t fb_font_glyph(const wchar_t ch)
     47uint16_t fb_font_glyph(const char32_t ch)
    4848{
    4949        if (ch == 0x0000)
  • uspace/srv/hid/output/gfx/font-8x16.h

    r4f663f3e r28a5ebd  
    4242#define FONT_SCANLINES  16
    4343
    44 extern uint16_t fb_font_glyph(const wchar_t);
     44extern uint16_t fb_font_glyph(const char32_t);
    4545extern uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES];
    4646
  • uspace/srv/hid/output/port/chardev.c

    r4f663f3e r28a5ebd  
    7878}
    7979
    80 static void chardev_putwchar(wchar_t ch)
     80static void chardev_putuchar(char32_t ch)
    8181{
    8282        if (chardev_bused == chardev_buf_size)
     
    9393        p = str;
    9494        while (*p != '\0')
    95                 chardev_putwchar(*p++);
     95                chardev_putuchar(*p++);
    9696}
    9797
     
    199199        }
    200200
    201         serial_init(chardev_putwchar, chardev_control_puts, chardev_flush);
     201        serial_init(chardev_putuchar, chardev_control_puts, chardev_flush);
    202202
    203203        discovery_finished = true;
  • uspace/srv/hid/output/port/kfb.c

    r4f663f3e r28a5ebd  
    7979
    8080/** Function to draw a character. */
    81 typedef void (*draw_char_t)(sysarg_t, sysarg_t, bool, wchar_t, pixel_t,
     81typedef void (*draw_char_t)(sysarg_t, sysarg_t, bool, char32_t, pixel_t,
    8282    pixel_t);
    8383
     
    287287 *
    288288 */
    289 static void draw_char_aligned(sysarg_t x, sysarg_t y, bool inverted, wchar_t ch,
     289static void draw_char_aligned(sysarg_t x, sysarg_t y, bool inverted, char32_t ch,
    290290    pixel_t bgcolor, pixel_t fgcolor)
    291291{
     
    350350 */
    351351static void draw_char_fallback(sysarg_t x, sysarg_t y, bool inverted,
    352     wchar_t ch, pixel_t bgcolor, pixel_t fgcolor)
     352    char32_t ch, pixel_t bgcolor, pixel_t fgcolor)
    353353{
    354354        /* Character glyph */
  • uspace/srv/hid/output/proto/vt100.c

    r4f663f3e r28a5ebd  
    140140
    141141vt100_state_t *vt100_state_create(sysarg_t cols, sysarg_t rows,
    142     vt100_putwchar_t putwchar_fn, vt100_control_puts_t control_puts_fn,
     142    vt100_putuchar_t putuchar_fn, vt100_control_puts_t control_puts_fn,
    143143    vt100_flush_t flush_fn)
    144144{
     
    147147                return NULL;
    148148
    149         state->putwchar = putwchar_fn;
     149        state->putuchar = putuchar_fn;
    150150        state->control_puts = control_puts_fn;
    151151        state->flush = flush_fn;
     
    220220}
    221221
    222 void vt100_putwchar(vt100_state_t *state, wchar_t ch)
    223 {
    224         state->putwchar(ch == 0 ? ' ' : ch);
     222void vt100_putuchar(vt100_state_t *state, char32_t ch)
     223{
     224        state->putuchar(ch == 0 ? ' ' : ch);
    225225        state->cur_col++;
    226226
  • uspace/srv/hid/output/proto/vt100.h

    r4f663f3e r28a5ebd  
    3636#include <io/charfield.h>
    3737
    38 typedef void (*vt100_putwchar_t)(wchar_t ch);
     38typedef void (*vt100_putuchar_t)(char32_t ch);
    3939typedef void (*vt100_control_puts_t)(const char *str);
    4040typedef void (*vt100_flush_t)(void);
     
    4848        char_attrs_t cur_attrs;
    4949
    50         vt100_putwchar_t putwchar;
     50        vt100_putuchar_t putuchar;
    5151        vt100_control_puts_t control_puts;
    5252        vt100_flush_t flush;
    5353} vt100_state_t;
    5454
    55 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putwchar_t,
     55extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putuchar_t,
    5656    vt100_control_puts_t, vt100_flush_t);
    5757extern void vt100_state_destroy(vt100_state_t *);
     
    6464extern void vt100_set_attr(vt100_state_t *, char_attrs_t);
    6565extern void vt100_cursor_visibility(vt100_state_t *, bool);
    66 extern void vt100_putwchar(vt100_state_t *, wchar_t);
     66extern void vt100_putuchar(vt100_state_t *, char32_t);
    6767extern void vt100_flush(vt100_state_t *);
    6868
  • uspace/srv/hid/remcons/user.c

    r4f663f3e r28a5ebd  
    218218 * @param c Pressed character.
    219219 */
    220 static kbd_event_t *new_kbd_event(kbd_event_type_t type, wchar_t c)
     220static kbd_event_t *new_kbd_event(kbd_event_type_t type, char32_t c)
    221221{
    222222        kbd_event_t *event = malloc(sizeof(kbd_event_t));
Note: See TracChangeset for help on using the changeset viewer.