Changeset 28a5ebd in mainline for uspace/srv/hid/input/layout/cz.c
- Timestamp:
- 2020-06-18T15:39:50Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce52c333
- Parents:
- 4f663f3e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.