Changeset 28a5ebd in mainline for uspace/srv/hid
- Timestamp:
- 2020-06-18T15:39:50Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce52c333
- Parents:
- 4f663f3e
- Location:
- uspace/srv/hid
- Files:
-
- 18 edited
-
compositor/compositor.c (modified) (2 diffs)
-
console/console.c (modified) (5 diffs)
-
input/layout.c (modified) (1 diff)
-
input/layout.h (modified) (2 diffs)
-
input/layout/ar.c (modified) (9 diffs)
-
input/layout/cz.c (modified) (23 diffs)
-
input/layout/fr_azerty.c (modified) (11 diffs)
-
input/layout/us_dvorak.c (modified) (12 diffs)
-
input/layout/us_qwerty.c (modified) (12 diffs)
-
output/ctl/serial.c (modified) (2 diffs)
-
output/ctl/serial.h (modified) (1 diff)
-
output/gfx/font-8x16.c (modified) (1 diff)
-
output/gfx/font-8x16.h (modified) (1 diff)
-
output/port/chardev.c (modified) (3 diffs)
-
output/port/kfb.c (modified) (3 diffs)
-
output/proto/vt100.c (modified) (3 diffs)
-
output/proto/vt100.h (modified) (3 diffs)
-
remcons/user.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
r4f663f3e r28a5ebd 156 156 static errno_t comp_active(input_t *); 157 157 static 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);158 static errno_t comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t); 159 159 static errno_t comp_mouse_move(input_t *, int, int); 160 160 static errno_t comp_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned); … … 1863 1863 1864 1864 static 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) 1866 1866 { 1867 1867 bool win_transform = (mods & KM_ALT) && -
uspace/srv/hid/console/console.c
r4f663f3e r28a5ebd 105 105 static errno_t input_ev_active(input_t *); 106 106 static 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);107 static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t); 108 108 static errno_t input_ev_move(input_t *, int, int); 109 109 static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned); … … 250 250 251 251 static 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) 253 253 { 254 254 if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) && … … 293 293 294 294 /** Process a character from the client (TTY emulation). */ 295 static void cons_write_char(console_t *cons, wchar_t ch)295 static void cons_write_char(console_t *cons, char32_t ch) 296 296 { 297 297 sysarg_t updated = 0; … … 312 312 break; 313 313 default: 314 updated = chargrid_put wchar(cons->frontbuf, ch, true);314 updated = chargrid_putuchar(cons->frontbuf, ch, true); 315 315 } 316 316 … … 371 371 /* Accept key presses of printable chars only. */ 372 372 if ((event->type == KEY_PRESS) && (event->c != 0)) { 373 wchar_t tmp[2] = { event->c, 0 };373 char32_t tmp[2] = { event->c, 0 }; 374 374 wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp); 375 375 cons->char_remains_len = str_size(cons->char_remains); -
uspace/srv/hid/input/layout.c
r4f663f3e r28a5ebd 69 69 70 70 /** Parse keyboard event. */ 71 wchar_t layout_parse_ev(layout_t *layout, kbd_event_t *ev)71 char32_t layout_parse_ev(layout_t *layout, kbd_event_t *ev) 72 72 { 73 73 return (*layout->ops->parse_ev)(layout, ev); -
uspace/srv/hid/input/layout.h
r4f663f3e r28a5ebd 53 53 errno_t (*create)(layout_t *); 54 54 void (*destroy)(layout_t *); 55 wchar_t (*parse_ev)(layout_t *, kbd_event_t *);55 char32_t (*parse_ev)(layout_t *, kbd_event_t *); 56 56 } layout_ops_t; 57 57 … … 64 64 extern layout_t *layout_create(layout_ops_t *); 65 65 extern void layout_destroy(layout_t *); 66 extern wchar_t layout_parse_ev(layout_t *, kbd_event_t *);66 extern char32_t layout_parse_ev(layout_t *, kbd_event_t *); 67 67 68 68 #endif -
uspace/srv/hid/input/layout/ar.c
r4f663f3e r28a5ebd 44 44 static errno_t ar_create(layout_t *); 45 45 static void ar_destroy(layout_t *); 46 static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);46 static char32_t ar_parse_ev(layout_t *, kbd_event_t *ev); 47 47 48 48 layout_ops_t ar_ops = { … … 52 52 }; 53 53 54 static wchar_t map_not_shifted[] = {54 static char32_t map_not_shifted[] = { 55 55 [KC_BACKTICK] = L'ذ', 56 56 … … 110 110 }; 111 111 112 static wchar_t map_shifted[] = {112 static char32_t map_shifted[] = { 113 113 [KC_BACKTICK] = L'ّ', 114 114 … … 168 168 }; 169 169 170 static wchar_t map_neutral[] = {170 static char32_t map_neutral[] = { 171 171 [KC_BACKSPACE] = '\b', 172 172 [KC_TAB] = '\t', … … 181 181 }; 182 182 183 static wchar_t map_numeric[] = {183 static char32_t map_numeric[] = { 184 184 [KC_N7] = '7', 185 185 [KC_N8] = '8', … … 196 196 }; 197 197 198 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)198 static char32_t translate(unsigned int key, char32_t *map, size_t map_length) 199 199 { 200 200 if (key >= map_length) … … 212 212 } 213 213 214 static wchar_t ar_parse_ev(layout_t *state, kbd_event_t *ev)215 { 216 wchar_t c;214 static char32_t ar_parse_ev(layout_t *state, kbd_event_t *ev) 215 { 216 char32_t c; 217 217 218 218 /* Produce no characters when Ctrl or Alt is pressed. */ … … 220 220 return 0; 221 221 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)); 223 223 if (c != 0) 224 224 return c; 225 225 226 226 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)); 228 228 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)); 230 230 231 231 if (c != 0) … … 233 233 234 234 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)); 236 236 else 237 237 c = 0; -
uspace/srv/hid/input/layout/cz.c
r4f663f3e r28a5ebd 45 45 static errno_t cz_create(layout_t *); 46 46 static void cz_destroy(layout_t *); 47 static wchar_t cz_parse_ev(layout_t *, kbd_event_t *ev);47 static char32_t cz_parse_ev(layout_t *, kbd_event_t *ev); 48 48 49 49 enum m_state { … … 63 63 }; 64 64 65 static wchar_t map_lcase[] = {65 static char32_t map_lcase[] = { 66 66 [KC_Q] = 'q', 67 67 [KC_W] = 'w', … … 94 94 }; 95 95 96 static wchar_t map_ucase[] = {96 static char32_t map_ucase[] = { 97 97 [KC_Q] = 'Q', 98 98 [KC_W] = 'W', … … 125 125 }; 126 126 127 static wchar_t map_not_shifted[] = {127 static char32_t map_not_shifted[] = { 128 128 [KC_BACKTICK] = ';', 129 129 … … 141 141 }; 142 142 143 static wchar_t map_shifted[] = {143 static char32_t map_shifted[] = { 144 144 [KC_1] = '1', 145 145 [KC_2] = '2', … … 167 167 }; 168 168 169 static wchar_t map_ns_nocaps[] = {169 static char32_t map_ns_nocaps[] = { 170 170 [KC_2] = L'ě', 171 171 [KC_3] = L'š', … … 182 182 }; 183 183 184 static wchar_t map_ns_caps[] = {184 static char32_t map_ns_caps[] = { 185 185 [KC_2] = L'Ě', 186 186 [KC_3] = L'Š', … … 197 197 }; 198 198 199 static wchar_t map_neutral[] = {199 static char32_t map_neutral[] = { 200 200 [KC_BACKSPACE] = '\b', 201 201 [KC_TAB] = '\t', … … 210 210 }; 211 211 212 static wchar_t map_numeric[] = {212 static char32_t map_numeric[] = { 213 213 [KC_N7] = '7', 214 214 [KC_N8] = '8', … … 225 225 }; 226 226 227 static wchar_t map_hacek_lcase[] = {227 static char32_t map_hacek_lcase[] = { 228 228 [KC_E] = L'ě', 229 229 [KC_R] = L'ř', … … 239 239 }; 240 240 241 static wchar_t map_hacek_ucase[] = {241 static char32_t map_hacek_ucase[] = { 242 242 [KC_E] = L'Ě', 243 243 [KC_R] = L'Ř', … … 253 253 }; 254 254 255 static wchar_t map_carka_lcase[] = {255 static char32_t map_carka_lcase[] = { 256 256 [KC_E] = L'é', 257 257 [KC_U] = L'ú', … … 264 264 }; 265 265 266 static wchar_t map_carka_ucase[] = {266 static char32_t map_carka_ucase[] = { 267 267 [KC_E] = L'É', 268 268 [KC_U] = L'Ú', … … 275 275 }; 276 276 277 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)277 static char32_t translate(unsigned int key, char32_t *map, size_t map_length) 278 278 { 279 279 if (key >= map_length) … … 282 282 } 283 283 284 static wchar_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev)285 { 286 wchar_t c;284 static char32_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev) 285 { 286 char32_t c; 287 287 288 288 cz_state->mstate = ms_start; … … 293 293 294 294 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)); 296 296 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)); 298 298 299 299 return c; 300 300 } 301 301 302 static wchar_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev)303 { 304 wchar_t c;302 static char32_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev) 303 { 304 char32_t c; 305 305 306 306 cz_state->mstate = ms_start; … … 311 311 312 312 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)); 314 314 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)); 316 316 317 317 return c; 318 318 } 319 319 320 static wchar_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev)321 { 322 wchar_t c;320 static char32_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev) 321 { 322 char32_t c; 323 323 324 324 /* Produce no characters when Ctrl or Alt is pressed. */ … … 335 335 } 336 336 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)); 338 338 if (c != 0) 339 339 return c; … … 341 341 if ((ev->mods & KM_SHIFT) == 0) { 342 342 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)); 344 344 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)); 346 346 347 347 if (c != 0) … … 350 350 351 351 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)); 353 353 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)); 355 355 356 356 if (c != 0) … … 358 358 359 359 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)); 361 361 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)); 363 363 364 364 if (c != 0) … … 366 366 367 367 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)); 369 369 else 370 370 c = 0; … … 409 409 } 410 410 411 static wchar_t cz_parse_ev(layout_t *state, kbd_event_t *ev)411 static char32_t cz_parse_ev(layout_t *state, kbd_event_t *ev) 412 412 { 413 413 layout_cz_t *cz_state = (layout_cz_t *) state->layout_priv; -
uspace/srv/hid/input/layout/fr_azerty.c
r4f663f3e r28a5ebd 43 43 static errno_t fr_azerty_create (layout_t *); 44 44 static void fr_azerty_destroy (layout_t *); 45 static wchar_t fr_azerty_parse_ev (layout_t *, kbd_event_t *);45 static char32_t fr_azerty_parse_ev (layout_t *, kbd_event_t *); 46 46 47 47 layout_ops_t fr_azerty_ops = { … … 51 51 }; 52 52 53 static wchar_t map_lcase[] = {53 static char32_t map_lcase[] = { 54 54 [KC_Q] = 'a', 55 55 [KC_W] = 'z', … … 82 82 }; 83 83 84 static wchar_t map_ucase[] = {84 static char32_t map_ucase[] = { 85 85 [KC_Q] = 'A', 86 86 [KC_W] = 'Z', … … 117 117 }; 118 118 119 static wchar_t map_not_shifted[] = {119 static char32_t map_not_shifted[] = { 120 120 [KC_BACKTICK] = L'²', 121 121 … … 146 146 }; 147 147 148 static wchar_t map_shifted[] = {148 static char32_t map_shifted[] = { 149 149 [KC_M] = '?', 150 150 [KC_BACKTICK] = '~', … … 176 176 }; 177 177 178 static wchar_t map_neutral[] = {178 static char32_t map_neutral[] = { 179 179 [KC_BACKSPACE] = '\b', 180 180 [KC_TAB] = '\t', … … 189 189 }; 190 190 191 static wchar_t map_numeric[] = {191 static char32_t map_numeric[] = { 192 192 [KC_N7] = '7', 193 193 [KC_N8] = '8', … … 204 204 }; 205 205 206 static wchar_t translate (unsigned int key, wchar_t *map, size_t map_len)206 static char32_t translate (unsigned int key, char32_t *map, size_t map_len) 207 207 { 208 208 if (key >= map_len) … … 221 221 } 222 222 223 static wchar_t fr_azerty_parse_ev (layout_t *s, kbd_event_t *e)223 static char32_t fr_azerty_parse_ev (layout_t *s, kbd_event_t *e) 224 224 { 225 225 if ((e->mods & (KM_CTRL | KM_ALT))) 226 226 return 0; // Produce no characters when Ctrl or Alt is pressed 227 227 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)); 229 229 if (c) 230 230 return c; 231 231 232 232 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)); 234 234 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)); 236 236 237 237 if (c) … … 239 239 240 240 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)); 242 242 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)); 244 244 245 245 if (c) … … 247 247 248 248 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)); 250 250 else 251 251 c = 0; -
uspace/srv/hid/input/layout/us_dvorak.c
r4f663f3e r28a5ebd 43 43 static errno_t us_dvorak_create(layout_t *); 44 44 static void us_dvorak_destroy(layout_t *); 45 static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);45 static char32_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev); 46 46 47 47 layout_ops_t us_dvorak_ops = { … … 51 51 }; 52 52 53 static wchar_t map_lcase[] = {53 static char32_t map_lcase[] = { 54 54 [KC_R] = 'p', 55 55 [KC_T] = 'y', … … 84 84 }; 85 85 86 static wchar_t map_ucase[] = {86 static char32_t map_ucase[] = { 87 87 [KC_R] = 'P', 88 88 [KC_T] = 'Y', … … 117 117 }; 118 118 119 static wchar_t map_not_shifted[] = {119 static char32_t map_not_shifted[] = { 120 120 [KC_BACKTICK] = '`', 121 121 … … 147 147 }; 148 148 149 static wchar_t map_shifted[] = {149 static char32_t map_shifted[] = { 150 150 [KC_BACKTICK] = '~', 151 151 … … 177 177 }; 178 178 179 static wchar_t map_neutral[] = {179 static char32_t map_neutral[] = { 180 180 [KC_BACKSPACE] = '\b', 181 181 [KC_TAB] = '\t', … … 190 190 }; 191 191 192 static wchar_t map_numeric[] = {192 static char32_t map_numeric[] = { 193 193 [KC_N7] = '7', 194 194 [KC_N8] = '8', … … 205 205 }; 206 206 207 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)207 static char32_t translate(unsigned int key, char32_t *map, size_t map_length) 208 208 { 209 209 if (key >= map_length) … … 221 221 } 222 222 223 static wchar_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev)224 { 225 wchar_t c;223 static char32_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev) 224 { 225 char32_t c; 226 226 227 227 /* Produce no characters when Ctrl or Alt is pressed. */ … … 229 229 return 0; 230 230 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)); 232 232 if (c != 0) 233 233 return c; 234 234 235 235 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)); 237 237 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)); 239 239 240 240 if (c != 0) … … 242 242 243 243 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)); 245 245 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)); 247 247 248 248 if (c != 0) … … 250 250 251 251 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)); 253 253 else 254 254 c = 0; -
uspace/srv/hid/input/layout/us_qwerty.c
r4f663f3e r28a5ebd 43 43 static errno_t us_qwerty_create(layout_t *); 44 44 static void us_qwerty_destroy(layout_t *); 45 static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);45 static char32_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev); 46 46 47 47 layout_ops_t us_qwerty_ops = { … … 51 51 }; 52 52 53 static wchar_t map_lcase[] = {53 static char32_t map_lcase[] = { 54 54 [KC_Q] = 'q', 55 55 [KC_W] = 'w', … … 82 82 }; 83 83 84 static wchar_t map_ucase[] = {84 static char32_t map_ucase[] = { 85 85 [KC_Q] = 'Q', 86 86 [KC_W] = 'W', … … 113 113 }; 114 114 115 static wchar_t map_not_shifted[] = {115 static char32_t map_not_shifted[] = { 116 116 [KC_BACKTICK] = '`', 117 117 … … 142 142 }; 143 143 144 static wchar_t map_shifted[] = {144 static char32_t map_shifted[] = { 145 145 [KC_BACKTICK] = '~', 146 146 … … 171 171 }; 172 172 173 static wchar_t map_neutral[] = {173 static char32_t map_neutral[] = { 174 174 [KC_BACKSPACE] = '\b', 175 175 [KC_TAB] = '\t', … … 184 184 }; 185 185 186 static wchar_t map_numeric[] = {186 static char32_t map_numeric[] = { 187 187 [KC_N7] = '7', 188 188 [KC_N8] = '8', … … 199 199 }; 200 200 201 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length)201 static char32_t translate(unsigned int key, char32_t *map, size_t map_length) 202 202 { 203 203 if (key >= map_length) … … 215 215 } 216 216 217 static wchar_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev)218 { 219 wchar_t c;217 static char32_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev) 218 { 219 char32_t c; 220 220 221 221 /* Produce no characters when Ctrl or Alt is pressed. */ … … 223 223 return 0; 224 224 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)); 226 226 if (c != 0) 227 227 return c; 228 228 229 229 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)); 231 231 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)); 233 233 234 234 if (c != 0) … … 236 236 237 237 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)); 239 239 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)); 241 241 242 242 if (c != 0) … … 244 244 245 245 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)); 247 247 else 248 248 c = 0; -
uspace/srv/hid/output/ctl/serial.c
r4f663f3e r28a5ebd 57 57 vt100_goto(state, col, row); 58 58 vt100_set_attr(state, field->attrs); 59 vt100_put wchar(state, field->ch);59 vt100_putuchar(state, field->ch); 60 60 } 61 61 … … 122 122 }; 123 123 124 errno_t serial_init(vt100_put wchar_t putwchar_fn,124 errno_t serial_init(vt100_putuchar_t putuchar_fn, 125 125 vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn) 126 126 { 127 127 vt100_state_t *state = 128 vt100_state_create(SERIAL_COLS, SERIAL_ROWS, put wchar_fn,128 vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putuchar_fn, 129 129 control_puts_fn, flush_fn); 130 130 if (state == NULL) -
uspace/srv/hid/output/ctl/serial.h
r4f663f3e r28a5ebd 37 37 #include "../proto/vt100.h" 38 38 39 extern errno_t serial_init(vt100_put wchar_t, vt100_control_puts_t, vt100_flush_t);39 extern errno_t serial_init(vt100_putuchar_t, vt100_control_puts_t, vt100_flush_t); 40 40 41 41 #endif -
uspace/srv/hid/output/gfx/font-8x16.c
r4f663f3e r28a5ebd 45 45 * 46 46 */ 47 uint16_t fb_font_glyph(const wchar_t ch)47 uint16_t fb_font_glyph(const char32_t ch) 48 48 { 49 49 if (ch == 0x0000) -
uspace/srv/hid/output/gfx/font-8x16.h
r4f663f3e r28a5ebd 42 42 #define FONT_SCANLINES 16 43 43 44 extern uint16_t fb_font_glyph(const wchar_t);44 extern uint16_t fb_font_glyph(const char32_t); 45 45 extern uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES]; 46 46 -
uspace/srv/hid/output/port/chardev.c
r4f663f3e r28a5ebd 78 78 } 79 79 80 static void chardev_put wchar(wchar_t ch)80 static void chardev_putuchar(char32_t ch) 81 81 { 82 82 if (chardev_bused == chardev_buf_size) … … 93 93 p = str; 94 94 while (*p != '\0') 95 chardev_put wchar(*p++);95 chardev_putuchar(*p++); 96 96 } 97 97 … … 199 199 } 200 200 201 serial_init(chardev_put wchar, chardev_control_puts, chardev_flush);201 serial_init(chardev_putuchar, chardev_control_puts, chardev_flush); 202 202 203 203 discovery_finished = true; -
uspace/srv/hid/output/port/kfb.c
r4f663f3e r28a5ebd 79 79 80 80 /** Function to draw a character. */ 81 typedef void (*draw_char_t)(sysarg_t, sysarg_t, bool, wchar_t, pixel_t,81 typedef void (*draw_char_t)(sysarg_t, sysarg_t, bool, char32_t, pixel_t, 82 82 pixel_t); 83 83 … … 287 287 * 288 288 */ 289 static void draw_char_aligned(sysarg_t x, sysarg_t y, bool inverted, wchar_t ch,289 static void draw_char_aligned(sysarg_t x, sysarg_t y, bool inverted, char32_t ch, 290 290 pixel_t bgcolor, pixel_t fgcolor) 291 291 { … … 350 350 */ 351 351 static 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) 353 353 { 354 354 /* Character glyph */ -
uspace/srv/hid/output/proto/vt100.c
r4f663f3e r28a5ebd 140 140 141 141 vt100_state_t *vt100_state_create(sysarg_t cols, sysarg_t rows, 142 vt100_put wchar_t putwchar_fn, vt100_control_puts_t control_puts_fn,142 vt100_putuchar_t putuchar_fn, vt100_control_puts_t control_puts_fn, 143 143 vt100_flush_t flush_fn) 144 144 { … … 147 147 return NULL; 148 148 149 state->put wchar = putwchar_fn;149 state->putuchar = putuchar_fn; 150 150 state->control_puts = control_puts_fn; 151 151 state->flush = flush_fn; … … 220 220 } 221 221 222 void vt100_put wchar(vt100_state_t *state, wchar_t ch)223 { 224 state->put wchar(ch == 0 ? ' ' : ch);222 void vt100_putuchar(vt100_state_t *state, char32_t ch) 223 { 224 state->putuchar(ch == 0 ? ' ' : ch); 225 225 state->cur_col++; 226 226 -
uspace/srv/hid/output/proto/vt100.h
r4f663f3e r28a5ebd 36 36 #include <io/charfield.h> 37 37 38 typedef void (*vt100_put wchar_t)(wchar_t ch);38 typedef void (*vt100_putuchar_t)(char32_t ch); 39 39 typedef void (*vt100_control_puts_t)(const char *str); 40 40 typedef void (*vt100_flush_t)(void); … … 48 48 char_attrs_t cur_attrs; 49 49 50 vt100_put wchar_t putwchar;50 vt100_putuchar_t putuchar; 51 51 vt100_control_puts_t control_puts; 52 52 vt100_flush_t flush; 53 53 } vt100_state_t; 54 54 55 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_put wchar_t,55 extern vt100_state_t *vt100_state_create(sysarg_t, sysarg_t, vt100_putuchar_t, 56 56 vt100_control_puts_t, vt100_flush_t); 57 57 extern void vt100_state_destroy(vt100_state_t *); … … 64 64 extern void vt100_set_attr(vt100_state_t *, char_attrs_t); 65 65 extern void vt100_cursor_visibility(vt100_state_t *, bool); 66 extern void vt100_put wchar(vt100_state_t *, wchar_t);66 extern void vt100_putuchar(vt100_state_t *, char32_t); 67 67 extern void vt100_flush(vt100_state_t *); 68 68 -
uspace/srv/hid/remcons/user.c
r4f663f3e r28a5ebd 218 218 * @param c Pressed character. 219 219 */ 220 static kbd_event_t *new_kbd_event(kbd_event_type_t type, wchar_t c)220 static kbd_event_t *new_kbd_event(kbd_event_type_t type, char32_t c) 221 221 { 222 222 kbd_event_t *event = malloc(sizeof(kbd_event_t));
Note:
See TracChangeset
for help on using the changeset viewer.
