Changeset 28a5ebd in mainline for uspace/srv/hid/input/layout/us_qwerty.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/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;
Note:
See TracChangeset
for help on using the changeset viewer.