Changeset 9db4079 in mainline
- Timestamp:
- 2009-04-05T09:27:12Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cee8d3e
- Parents:
- b27eb71
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/include/kbd/kbd.h
rb27eb71 r9db4079 36 36 #define LIBC_KBD_H_ 37 37 38 #include <sys/types.h> 39 38 40 typedef enum kbd_ev_type { 39 41 KE_PRESS, … … 53 55 54 56 /** The character that was generated or '\0' for none. */ 55 charc;57 wchar_t c; 56 58 } kbd_event_t; 57 59 -
uspace/srv/kbd/generic/key_buffer.c
rb27eb71 r9db4079 94 94 } 95 95 96 void keybuffer_push0(keybuffer_t *keybuffer, int c)97 {98 kbd_event_t ev;99 100 ev.key = c; ev.mods = 0; ev.c = c;101 keybuffer_push(keybuffer, &ev);102 }103 104 96 /** Pop event from buffer. 105 97 * -
uspace/srv/kbd/include/key_buffer.h
rb27eb71 r9db4079 56 56 extern int keybuffer_empty(keybuffer_t *); 57 57 extern void keybuffer_push(keybuffer_t *, const kbd_event_t *); 58 extern void keybuffer_push0(keybuffer_t *, int c);59 58 extern int keybuffer_pop(keybuffer_t *, kbd_event_t *); 60 59 -
uspace/srv/kbd/include/layout.h
rb27eb71 r9db4079 39 39 40 40 #include <kbd/kbd.h> 41 #include <sys/types.h> 41 42 42 extern charlayout_parse_ev(kbd_event_t *);43 extern wchar_t layout_parse_ev(kbd_event_t *); 43 44 44 45 #endif -
uspace/srv/kbd/layout/us_dvorak.c
rb27eb71 r9db4079 37 37 #include <layout.h> 38 38 39 static charmap_lcase[] = {39 static wchar_t map_lcase[] = { 40 40 [KC_R] = 'p', 41 41 [KC_T] = 'y', … … 70 70 }; 71 71 72 static charmap_ucase[] = {72 static wchar_t map_ucase[] = { 73 73 [KC_R] = 'P', 74 74 [KC_T] = 'Y', … … 103 103 }; 104 104 105 static charmap_not_shifted[] = {105 static wchar_t map_not_shifted[] = { 106 106 [KC_BACKTICK] = '`', 107 107 … … 133 133 }; 134 134 135 static charmap_shifted[] = {135 static wchar_t map_shifted[] = { 136 136 [KC_BACKTICK] = '~', 137 137 … … 163 163 }; 164 164 165 static charmap_neutral[] = {165 static wchar_t map_neutral[] = { 166 166 [KC_BACKSPACE] = '\b', 167 167 [KC_TAB] = '\t', … … 176 176 }; 177 177 178 static charmap_numeric[] = {178 static wchar_t map_numeric[] = { 179 179 [KC_N7] = '7', 180 180 [KC_N8] = '8', … … 191 191 }; 192 192 193 static int translate(unsigned int key, char*map, size_t map_length)193 static wchar_t translate(unsigned int key, wchar_t *map, size_t map_length) 194 194 { 195 195 if (key >= map_length) … … 198 198 } 199 199 200 charlayout_parse_ev(kbd_event_t *ev)200 wchar_t layout_parse_ev(kbd_event_t *ev) 201 201 { 202 charc;202 wchar_t c; 203 203 204 204 /* Produce no characters when Ctrl or Alt is pressed. */ … … 206 206 return 0; 207 207 208 c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof( char));208 c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(wchar_t)); 209 209 if (c != 0) 210 210 return c; 211 211 212 212 if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0)) 213 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof( char));213 c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(wchar_t)); 214 214 else 215 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof( char));215 c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(wchar_t)); 216 216 217 217 if (c != 0) … … 219 219 220 220 if ((ev->mods & KM_SHIFT) != 0) 221 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof( char));221 c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(wchar_t)); 222 222 else 223 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof( char));223 c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(wchar_t)); 224 224 225 225 if (c != 0) … … 227 227 228 228 if ((ev->mods & KM_NUM_LOCK) != 0) 229 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof( char));229 c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(wchar_t)); 230 230 else 231 231 c = 0; -
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.