Changeset 9db4079 in mainline for uspace/srv/kbd/layout/us_qwerty.c
- Timestamp:
- 2009-04-05T09:27:12Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cee8d3e
- Parents:
- b27eb71
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/kbd/layout/us_qwerty.c
rb27eb71 r9db4079 37 37 #include <layout.h> 38 38 39 static charmap_lcase[] = {39 static wchar_t map_lcase[] = { 40 40 [KC_Q] = 'q', 41 41 [KC_W] = 'w', … … 68 68 }; 69 69 70 static charmap_ucase[] = {70 static wchar_t map_ucase[] = { 71 71 [KC_Q] = 'Q', 72 72 [KC_W] = 'W', … … 99 99 }; 100 100 101 static charmap_not_shifted[] = {101 static wchar_t map_not_shifted[] = { 102 102 [KC_BACKTICK] = '`', 103 103 … … 128 128 }; 129 129 130 static charmap_shifted[] = {130 static wchar_t map_shifted[] = { 131 131 [KC_BACKTICK] = '~', 132 132 … … 157 157 }; 158 158 159 static charmap_neutral[] = {159 static wchar_t map_neutral[] = { 160 160 [KC_BACKSPACE] = '\b', 161 161 [KC_TAB] = '\t', … … 170 170 }; 171 171 172 static charmap_numeric[] = {172 static wchar_t map_numeric[] = { 173 173 [KC_N7] = '7', 174 174 [KC_N8] = '8', … … 185 185 }; 186 186 187 static int translate(unsigned int key, char*map, size_t map_length)187 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length) 188 188 { 189 if (key >= map_length) return 0; 190 return map[key]; 189 if (key >= map_length) 190 return 0; 191 return map[key]; 191 192 } 192 193 193 charlayout_parse_ev(kbd_event_t *ev)194 wchar_t layout_parse_ev(kbd_event_t *ev) 194 195 { 195 charc;196 wchar_t c; 196 197 197 198 /* Produce no characters when Ctrl or Alt is pressed. */ … … 199 200 return 0; 200 201 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; 203 205 204 206 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)); 206 208 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; 210 213 211 214 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)); 213 216 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; 217 221 218 222 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)); 220 224 else 221 225 c = 0;
Note:
See TracChangeset
for help on using the changeset viewer.