|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "config.h" |
|
20 #include "PlatformKeyboardEvent.h" |
|
21 #include "DeprecatedCString.h" |
|
22 |
|
23 #include <e32keys.h> |
|
24 #include <w32std.h> |
|
25 #include <ctype.h> |
|
26 |
|
27 namespace WebCore { |
|
28 |
|
29 |
|
30 |
|
31 static String KeyIdentifierForKeyEvent(TInt code) |
|
32 { |
|
33 switch (code) |
|
34 { |
|
35 // Each identifier listed in the DOM spec is listed here. |
|
36 // Many are simply commented out since they do not appear on standard Macintosh keyboards |
|
37 // or are on a key that doesn't have a corresponding character. |
|
38 |
|
39 // "Accept" |
|
40 // "AllCandidates" |
|
41 |
|
42 // "Alt" |
|
43 case EKeyLeftAlt: |
|
44 case EKeyRightAlt: |
|
45 return "Alt"; |
|
46 |
|
47 // "Apps" |
|
48 // "BrowserBack" |
|
49 // "BrowserForward" |
|
50 // "BrowserHome" |
|
51 // "BrowserRefresh" |
|
52 // "BrowserSearch" |
|
53 // "BrowserStop" |
|
54 // "CapsLock" |
|
55 |
|
56 // "Clear" |
|
57 // case NSClearLineFunctionKey: |
|
58 // return "Clear"; |
|
59 |
|
60 // "CodeInput" |
|
61 // "Compose" |
|
62 // "Control" |
|
63 // "Crsel" |
|
64 // "Convert" |
|
65 // "Copy" |
|
66 // "Cut" |
|
67 |
|
68 // "Down" |
|
69 case EKeyDownArrow: |
|
70 return "Down"; |
|
71 // "End" |
|
72 case EKeyEnd: |
|
73 return "End"; |
|
74 // "Enter" |
|
75 case EKeyEnter: |
|
76 case EKeyDevice3: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM |
|
77 return "Enter"; |
|
78 |
|
79 // "EraseEof" |
|
80 |
|
81 // "Execute" |
|
82 // case NSExecuteFunctionKey: |
|
83 // return "Execute"; |
|
84 |
|
85 // "Exsel" |
|
86 |
|
87 /* // "F1" |
|
88 case NSF1FunctionKey: |
|
89 return "F1"; |
|
90 // "F2" |
|
91 case NSF2FunctionKey: |
|
92 return "F2"; |
|
93 // "F3" |
|
94 case NSF3FunctionKey: |
|
95 return "F3"; |
|
96 // "F4" |
|
97 case NSF4FunctionKey: |
|
98 return "F4"; |
|
99 // "F5" |
|
100 case NSF5FunctionKey: |
|
101 return "F5"; |
|
102 // "F6" |
|
103 case NSF6FunctionKey: |
|
104 return "F6"; |
|
105 // "F7" |
|
106 case NSF7FunctionKey: |
|
107 return "F7"; |
|
108 // "F8" |
|
109 case NSF8FunctionKey: |
|
110 return "F8"; |
|
111 // "F9" |
|
112 case NSF9FunctionKey: |
|
113 return "F9"; |
|
114 // "F10" |
|
115 case NSF10FunctionKey: |
|
116 return "F10"; |
|
117 // "F11" |
|
118 case NSF11FunctionKey: |
|
119 return "F11"; |
|
120 // "F12" |
|
121 case NSF12FunctionKey: |
|
122 return "F12"; |
|
123 // "F13" |
|
124 case NSF13FunctionKey: |
|
125 return "F13"; |
|
126 // "F14" |
|
127 case NSF14FunctionKey: |
|
128 return "F14"; |
|
129 // "F15" |
|
130 case NSF15FunctionKey: |
|
131 return "F15"; |
|
132 // "F16" |
|
133 case NSF16FunctionKey: |
|
134 return "F16"; |
|
135 // "F17" |
|
136 case NSF17FunctionKey: |
|
137 return "F17"; |
|
138 // "F18" |
|
139 case NSF18FunctionKey: |
|
140 return "F18"; |
|
141 // "F19" |
|
142 case NSF19FunctionKey: |
|
143 return "F19"; |
|
144 // "F20" |
|
145 case NSF20FunctionKey: |
|
146 return "F20"; |
|
147 // "F21" |
|
148 case NSF21FunctionKey: |
|
149 return "F21"; |
|
150 // "F22" |
|
151 case NSF22FunctionKey: |
|
152 return "F22"; |
|
153 // "F23" |
|
154 case NSF23FunctionKey: |
|
155 return "F23"; |
|
156 // "F24" |
|
157 case NSF24FunctionKey: |
|
158 return "F24"; |
|
159 */ |
|
160 // "FinalMode" |
|
161 |
|
162 // "Find" |
|
163 // case NSFindFunctionKey: |
|
164 // return "Find"; |
|
165 |
|
166 // "FullWidth" |
|
167 // "HalfWidth" |
|
168 // "HangulMode" |
|
169 // "HanjaMode" |
|
170 |
|
171 // "Help" |
|
172 // case NSHelpFunctionKey: |
|
173 // return "Help"; |
|
174 |
|
175 // "Hiragana" |
|
176 |
|
177 // "Home" |
|
178 // case NSHomeFunctionKey: |
|
179 // return "Home"; |
|
180 // "Insert" |
|
181 // case NSInsertFunctionKey: |
|
182 // return "Insert"; |
|
183 |
|
184 // "JapaneseHiragana" |
|
185 // "JapaneseKatakana" |
|
186 // "JapaneseRomaji" |
|
187 // "JunjaMode" |
|
188 // "KanaMode" |
|
189 // "KanjiMode" |
|
190 // "Katakana" |
|
191 // "LaunchApplication1" |
|
192 // "LaunchApplication2" |
|
193 // "LaunchMail" |
|
194 |
|
195 // "Left" |
|
196 case EKeyLeftArrow: |
|
197 return "Left"; |
|
198 |
|
199 // "Meta" |
|
200 // "MediaNextTrack" |
|
201 // "MediaPlayPause" |
|
202 // "MediaPreviousTrack" |
|
203 // "MediaStop" |
|
204 |
|
205 // "ModeChange" |
|
206 // case NSModeSwitchFunctionKey: |
|
207 // return "ModeChange"; |
|
208 |
|
209 // "Nonconvert" |
|
210 // "NumLock" |
|
211 |
|
212 // "PageDown" |
|
213 case EKeyPageDown: |
|
214 return "PageDown"; |
|
215 // "PageUp" |
|
216 case EKeyPageUp: |
|
217 return "PageUp"; |
|
218 |
|
219 // "Paste" |
|
220 |
|
221 // "Pause" |
|
222 // case NSPauseFunctionKey: |
|
223 // return "Pause"; |
|
224 |
|
225 // "Play" |
|
226 // "PreviousCandidate" |
|
227 |
|
228 // "PrintScreen" |
|
229 // case NSPrintScreenFunctionKey: |
|
230 // return "PrintScreen"; |
|
231 |
|
232 // "Process" |
|
233 // "Props" |
|
234 |
|
235 // "Right" |
|
236 case EKeyRightArrow: |
|
237 return "Right"; |
|
238 |
|
239 // "RomanCharacters" |
|
240 |
|
241 // "Scroll" |
|
242 // case NSScrollLockFunctionKey: |
|
243 // return "Scroll"; |
|
244 // "Select" |
|
245 // case NSSelectFunctionKey: |
|
246 // return "Select"; |
|
247 |
|
248 // "SelectMedia" |
|
249 // "Shift" |
|
250 |
|
251 // "Stop" |
|
252 // case NSStopFunctionKey: |
|
253 // return "Stop"; |
|
254 // "Up" |
|
255 case EKeyUpArrow: |
|
256 return "Up"; |
|
257 // "Undo" |
|
258 // case NSUndoFunctionKey: |
|
259 // return "Undo"; |
|
260 |
|
261 // "VolumeDown" |
|
262 // "VolumeMute" |
|
263 // "VolumeUp" |
|
264 // "Win" |
|
265 // "Zoom" |
|
266 |
|
267 // More function keys, not in the key identifier specification. |
|
268 /* case NSF25FunctionKey: |
|
269 return "F25"; |
|
270 case NSF26FunctionKey: |
|
271 return "F26"; |
|
272 case NSF27FunctionKey: |
|
273 return "F27"; |
|
274 case NSF28FunctionKey: |
|
275 return "F28"; |
|
276 case NSF29FunctionKey: |
|
277 return "F29"; |
|
278 case NSF30FunctionKey: |
|
279 return "F30"; |
|
280 case NSF31FunctionKey: |
|
281 return "F31"; |
|
282 case NSF32FunctionKey: |
|
283 return "F32"; |
|
284 case NSF33FunctionKey: |
|
285 return "F33"; |
|
286 case NSF34FunctionKey: |
|
287 return "F34"; |
|
288 case NSF35FunctionKey: |
|
289 return "F35"; |
|
290 |
|
291 // Turn 0x7F into 0x08, because backspace needs to always be 0x08. |
|
292 case 0x7F: |
|
293 return "U+000008"; |
|
294 // Standard says that DEL becomes U+00007F. |
|
295 case NSDeleteFunctionKey: |
|
296 return "U+00007F"; |
|
297 |
|
298 case NSBeginFunctionKey: |
|
299 case NSBreakFunctionKey: |
|
300 case NSClearDisplayFunctionKey: |
|
301 case NSDeleteCharFunctionKey: |
|
302 case NSDeleteLineFunctionKey: |
|
303 case NSInsertCharFunctionKey: |
|
304 case NSInsertLineFunctionKey: |
|
305 case NSNextFunctionKey: |
|
306 case NSPrevFunctionKey: |
|
307 case NSPrintFunctionKey: |
|
308 case NSRedoFunctionKey: |
|
309 case NSResetFunctionKey: |
|
310 case NSSysReqFunctionKey: |
|
311 case NSSystemFunctionKey: |
|
312 case NSUserFunctionKey:*/ |
|
313 // FIXME: We should use something other than the vendor-area Unicode values for the above keys. |
|
314 // For now, just fall through to the default. |
|
315 default: |
|
316 return String::format("U+%06X", toupper(code)); |
|
317 } |
|
318 return ""; |
|
319 } |
|
320 |
|
321 static int WindowsKeyCodeForKeyEvent(TKeyEvent aEvent) |
|
322 { |
|
323 /*switch ([event keyCode]) { |
|
324 // VK_CLEAR (0C) CLEAR key |
|
325 case 71: return 0x0C; |
|
326 |
|
327 // VK_NUMPAD0 (60) Numeric keypad 0 key |
|
328 case 82: return 0x60; |
|
329 // VK_NUMPAD1 (61) Numeric keypad 1 key |
|
330 case 83: return 0x61; |
|
331 // VK_NUMPAD2 (62) Numeric keypad 2 key |
|
332 case 84: return 0x62; |
|
333 // VK_NUMPAD3 (63) Numeric keypad 3 key |
|
334 case 85: return 0x63; |
|
335 // VK_NUMPAD4 (64) Numeric keypad 4 key |
|
336 case 86: return 0x64; |
|
337 // VK_NUMPAD5 (65) Numeric keypad 5 key |
|
338 case 87: return 0x65; |
|
339 // VK_NUMPAD6 (66) Numeric keypad 6 key |
|
340 case 88: return 0x66; |
|
341 // VK_NUMPAD7 (67) Numeric keypad 7 key |
|
342 case 89: return 0x67; |
|
343 // VK_NUMPAD8 (68) Numeric keypad 8 key |
|
344 case 91: return 0x68; |
|
345 // VK_NUMPAD9 (69) Numeric keypad 9 key |
|
346 case 92: return 0x69; |
|
347 // VK_MULTIPLY (6A) Multiply key |
|
348 case 67: return 0x6A; |
|
349 // VK_ADD (6B) Add key |
|
350 case 69: return 0x6B; |
|
351 |
|
352 // VK_SUBTRACT (6D) Subtract key |
|
353 case 78: return 0x6D; |
|
354 // VK_DECIMAL (6E) Decimal key |
|
355 case 65: return 0x6E; |
|
356 // VK_DIVIDE (6F) Divide key |
|
357 case 75: return 0x6F; |
|
358 } |
|
359 */ |
|
360 |
|
361 switch (aEvent.iCode) |
|
362 { |
|
363 // VK_LBUTTON (01) Left mouse button |
|
364 // VK_RBUTTON (02) Right mouse button |
|
365 // VK_CANCEL (03) Control-break processing |
|
366 // VK_MBUTTON (04) Middle mouse button (three-button mouse) |
|
367 // VK_XBUTTON1 (05) |
|
368 // VK_XBUTTON2 (06) |
|
369 |
|
370 // VK_BACK (08) BACKSPACE key |
|
371 case 8: case 0x7F: return 0x08; |
|
372 // VK_TAB (09) TAB key |
|
373 case 9: return 0x09; |
|
374 |
|
375 // VK_CLEAR (0C) CLEAR key |
|
376 // handled by key code above |
|
377 |
|
378 // VK_RETURN (0D) |
|
379 case 0xD: case 3: return 0x0D; |
|
380 |
|
381 // VK_SHIFT (10) SHIFT key |
|
382 // VK_CONTROL (11) CTRL key |
|
383 // VK_MENU (12) ALT key |
|
384 |
|
385 // VK_PAUSE (13) PAUSE key |
|
386 //case NSPauseFunctionKey: return 0x13; |
|
387 |
|
388 // VK_CAPITAL (14) CAPS LOCK key |
|
389 // VK_KANA (15) Input Method Editor (IME) Kana mode |
|
390 // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) |
|
391 // VK_HANGUL (15) IME Hangul mode |
|
392 // VK_JUNJA (17) IME Junja mode |
|
393 // VK_FINAL (18) IME final mode |
|
394 // VK_HANJA (19) IME Hanja mode |
|
395 // VK_KANJI (19) IME Kanji mode |
|
396 |
|
397 // VK_ESCAPE (1B) ESC key |
|
398 case 0x1B: return 0x1B; |
|
399 |
|
400 // VK_CONVERT (1C) IME convert |
|
401 // VK_NONCONVERT (1D) IME nonconvert |
|
402 // VK_ACCEPT (1E) IME accept |
|
403 // VK_MODECHANGE (1F) IME mode change request |
|
404 |
|
405 // VK_SPACE (20) SPACEBAR |
|
406 case ' ': return 0x20; |
|
407 // VK_PRIOR (21) PAGE UP key |
|
408 case EKeyPageUp: return 0x21; |
|
409 // VK_NEXT (22) PAGE DOWN key |
|
410 case EKeyPageDown: return 0x22; |
|
411 // VK_END (23) END key |
|
412 case EKeyEnd: return 0x23; |
|
413 // VK_HOME (24) HOME key |
|
414 case EKeyHome: return 0x24; |
|
415 // VK_LEFT (25) LEFT ARROW key |
|
416 case EKeyLeftArrow: return 0x25; |
|
417 // VK_UP (26) UP ARROW key |
|
418 case EKeyUpArrow: return 0x26; |
|
419 // VK_RIGHT (27) RIGHT ARROW key |
|
420 case EKeyRightArrow: return 0x27; |
|
421 // VK_DOWN (28) DOWN ARROW key |
|
422 case EKeyDownArrow: return 0x28; |
|
423 // VK_SELECT (29) SELECT key |
|
424 //case NSSelectFunctionKey: return 0x29; |
|
425 // VK_PRINT (2A) PRINT key |
|
426 //case NSPrintFunctionKey: return 0x2A; |
|
427 // VK_EXECUTE (2B) EXECUTE key |
|
428 //case NSExecuteFunctionKey: return 0x2B; |
|
429 // VK_SNAPSHOT (2C) PRINT SCREEN key |
|
430 //case NSPrintScreenFunctionKey: return 0x2C; |
|
431 // VK_INSERT (2D) INS key |
|
432 case EKeyInsert: return 0x2D; |
|
433 // VK_DELETE (2E) DEL key |
|
434 //case NSDeleteFunctionKey: return 0x2E; |
|
435 |
|
436 // VK_HELP (2F) HELP key |
|
437 |
|
438 // (30) 0 key |
|
439 case '0': case ')': return 0x30; |
|
440 // (31) 1 key |
|
441 case '1': case '!': return 0x31; |
|
442 // (32) 2 key |
|
443 case '2': case '@': return 0x32; |
|
444 // (33) 3 key |
|
445 case '3': case '#': return 0x33; |
|
446 // (34) 4 key |
|
447 case '4': case '$': return 0x34; |
|
448 // (35) 5 key |
|
449 case '5': case '%': return 0x35; |
|
450 // (36) 6 key |
|
451 case '6': case '^': return 0x36; |
|
452 // (37) 7 key |
|
453 case '7': case '&': return 0x37; |
|
454 // (38) 8 key |
|
455 case '8': case '*': return 0x38; |
|
456 // (39) 9 key |
|
457 case '9': case '(': return 0x39; |
|
458 // (41) A key |
|
459 case 'a': case 'A': return 0x41; |
|
460 // (42) B key |
|
461 case 'b': case 'B': return 0x42; |
|
462 // (43) C key |
|
463 case 'c': case 'C': return 0x43; |
|
464 // (44) D key |
|
465 case 'd': case 'D': return 0x44; |
|
466 // (45) E key |
|
467 case 'e': case 'E': return 0x45; |
|
468 // (46) F key |
|
469 case 'f': case 'F': return 0x46; |
|
470 // (47) G key |
|
471 case 'g': case 'G': return 0x47; |
|
472 // (48) H key |
|
473 case 'h': case 'H': return 0x48; |
|
474 // (49) I key |
|
475 case 'i': case 'I': return 0x49; |
|
476 // (4A) J key |
|
477 case 'j': case 'J': return 0x4A; |
|
478 // (4B) K key |
|
479 case 'k': case 'K': return 0x4B; |
|
480 // (4C) L key |
|
481 case 'l': case 'L': return 0x4C; |
|
482 // (4D) M key |
|
483 case 'm': case 'M': return 0x4D; |
|
484 // (4E) N key |
|
485 case 'n': case 'N': return 0x4E; |
|
486 // (4F) O key |
|
487 case 'o': case 'O': return 0x4F; |
|
488 // (50) P key |
|
489 case 'p': case 'P': return 0x50; |
|
490 // (51) Q key |
|
491 case 'q': case 'Q': return 0x51; |
|
492 // (52) R key |
|
493 case 'r': case 'R': return 0x52; |
|
494 // (53) S key |
|
495 case 's': case 'S': return 0x53; |
|
496 // (54) T key |
|
497 case 't': case 'T': return 0x54; |
|
498 // (55) U key |
|
499 case 'u': case 'U': return 0x55; |
|
500 // (56) V key |
|
501 case 'v': case 'V': return 0x56; |
|
502 // (57) W key |
|
503 case 'w': case 'W': return 0x57; |
|
504 // (58) X key |
|
505 case 'x': case 'X': return 0x58; |
|
506 // (59) Y key |
|
507 case 'y': case 'Y': return 0x59; |
|
508 // (5A) Z key |
|
509 case 'z': case 'Z': return 0x5A; |
|
510 |
|
511 // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) |
|
512 // VK_RWIN (5C) Right Windows key (Natural keyboard) |
|
513 // VK_APPS (5D) Applications key (Natural keyboard) |
|
514 // VK_SLEEP (5F) Computer Sleep key |
|
515 |
|
516 // VK_NUMPAD0 (60) Numeric keypad 0 key |
|
517 // VK_NUMPAD1 (61) Numeric keypad 1 key |
|
518 // VK_NUMPAD2 (62) Numeric keypad 2 key |
|
519 // VK_NUMPAD3 (63) Numeric keypad 3 key |
|
520 // VK_NUMPAD4 (64) Numeric keypad 4 key |
|
521 // VK_NUMPAD5 (65) Numeric keypad 5 key |
|
522 // VK_NUMPAD6 (66) Numeric keypad 6 key |
|
523 // VK_NUMPAD7 (67) Numeric keypad 7 key |
|
524 // VK_NUMPAD8 (68) Numeric keypad 8 key |
|
525 // VK_NUMPAD9 (69) Numeric keypad 9 key |
|
526 // VK_MULTIPLY (6A) Multiply key |
|
527 // VK_ADD (6B) Add key |
|
528 // handled by key code above |
|
529 |
|
530 // VK_SEPARATOR (6C) Separator key |
|
531 |
|
532 // VK_SUBTRACT (6D) Subtract key |
|
533 // VK_DECIMAL (6E) Decimal key |
|
534 // VK_DIVIDE (6F) Divide key |
|
535 // handled by key code above |
|
536 |
|
537 // VK_F1 (70) F1 key |
|
538 case EKeyF1: return 0x70; |
|
539 // VK_F2 (71) F2 key |
|
540 case EKeyF2: return 0x71; |
|
541 // VK_F3 (72) F3 key |
|
542 case EKeyF3: return 0x72; |
|
543 // VK_F4 (73) F4 key |
|
544 case EKeyF4: return 0x73; |
|
545 // VK_F5 (74) F5 key |
|
546 case EKeyF5: return 0x74; |
|
547 // VK_F6 (75) F6 key |
|
548 case EKeyF6: return 0x75; |
|
549 // VK_F7 (76) F7 key |
|
550 case EKeyF7: return 0x76; |
|
551 // VK_F8 (77) F8 key |
|
552 case EKeyF8: return 0x77; |
|
553 // VK_F9 (78) F9 key |
|
554 case EKeyF9: return 0x78; |
|
555 // VK_F10 (79) F10 key |
|
556 case EKeyF10: return 0x79; |
|
557 // VK_F11 (7A) F11 key |
|
558 case EKeyF11: return 0x7A; |
|
559 // VK_F12 (7B) F12 key |
|
560 case EKeyF12: return 0x7B; |
|
561 // VK_F13 (7C) F13 key |
|
562 case EKeyF13: return 0x7C; |
|
563 // VK_F14 (7D) F14 key |
|
564 case EKeyF14: return 0x7D; |
|
565 // VK_F15 (7E) F15 key |
|
566 case EKeyF15: return 0x7E; |
|
567 // VK_F16 (7F) F16 key |
|
568 case EKeyF16: return 0x7F; |
|
569 // VK_F17 (80H) F17 key |
|
570 case EKeyF17: return 0x80; |
|
571 // VK_F18 (81H) F18 key |
|
572 case EKeyF18: return 0x81; |
|
573 // VK_F19 (82H) F19 key |
|
574 case EKeyF19: return 0x82; |
|
575 // VK_F20 (83H) F20 key |
|
576 case EKeyF20: return 0x83; |
|
577 // VK_F21 (84H) F21 key |
|
578 case EKeyF21: return 0x84; |
|
579 // VK_F22 (85H) F22 key |
|
580 case EKeyF22: return 0x85; |
|
581 // VK_F23 (86H) F23 key |
|
582 case EKeyF23: return 0x86; |
|
583 // VK_F24 (87H) F24 key |
|
584 case EKeyF24: return 0x87; |
|
585 |
|
586 // VK_NUMLOCK (90) NUM LOCK key |
|
587 |
|
588 // VK_SCROLL (91) SCROLL LOCK key |
|
589 case EKeyScrollLock: return 0x91; |
|
590 |
|
591 // VK_LSHIFT (A0) Left SHIFT key |
|
592 // VK_RSHIFT (A1) Right SHIFT key |
|
593 // VK_LCONTROL (A2) Left CONTROL key |
|
594 // VK_RCONTROL (A3) Right CONTROL key |
|
595 // VK_LMENU (A4) Left MENU key |
|
596 // VK_RMENU (A5) Right MENU key |
|
597 // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key |
|
598 // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key |
|
599 // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key |
|
600 // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key |
|
601 // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key |
|
602 // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key |
|
603 // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key |
|
604 // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key |
|
605 // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key |
|
606 // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key |
|
607 // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key |
|
608 // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key |
|
609 // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key |
|
610 // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key |
|
611 // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key |
|
612 // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key |
|
613 // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key |
|
614 // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key |
|
615 |
|
616 // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key |
|
617 case ';': case ':': return 0xBA; |
|
618 // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key |
|
619 case '=': case '+': return 0xBB; |
|
620 // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key |
|
621 case ',': case '<': return 0xBC; |
|
622 // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key |
|
623 case '-': case '_': return 0xBD; |
|
624 // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key |
|
625 case '.': case '>': return 0xBE; |
|
626 // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key |
|
627 case '/': case '?': return 0xBF; |
|
628 // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key |
|
629 case '`': case '~': return 0xC0; |
|
630 // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key |
|
631 case '[': case '{': return 0xDB; |
|
632 // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key |
|
633 case '\\': case '|': return 0xDC; |
|
634 // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key |
|
635 case ']': case '}': return 0xDD; |
|
636 // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key |
|
637 case '\'': case '"': return 0xDE; |
|
638 |
|
639 // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. |
|
640 // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard |
|
641 // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key |
|
642 // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP |
|
643 // VK_ATTN (F6) Attn key |
|
644 // VK_CRSEL (F7) CrSel key |
|
645 // VK_EXSEL (F8) ExSel key |
|
646 // VK_EREOF (F9) Erase EOF key |
|
647 // VK_PLAY (FA) Play key |
|
648 // VK_ZOOM (FB) Zoom key |
|
649 // VK_NONAME (FC) Reserved for future use |
|
650 // VK_PA1 (FD) PA1 key |
|
651 // VK_OEM_CLEAR (FE) Clear key |
|
652 } |
|
653 |
|
654 // Workaround to provide MSK keycode to JavaScript "keypres" event since MSK KeyEvent does not reach to BrowserEngine. |
|
655 if((aEvent.iCode == 0) && (aEvent.iScanCode==EStdKeyDevice3)) |
|
656 return EKeyDevice3; |
|
657 |
|
658 return 0; |
|
659 } |
|
660 |
|
661 PlatformKeyboardEvent::PlatformKeyboardEvent( TKeyEvent event, TEventCode eventCode, bool forceAutoRepeat ) : |
|
662 m_keyIdentifier(KeyIdentifierForKeyEvent(event.iCode)) |
|
663 , m_isKeyUp( eventCode == EEventKeyUp ) |
|
664 , m_autoRepeat(event.iRepeats>0 || forceAutoRepeat ) |
|
665 , m_WindowsKeyCode(WindowsKeyCodeForKeyEvent(event)) |
|
666 , m_shiftKey( event.iModifiers & EModifierShift ) |
|
667 , m_ctrlKey( event.iModifiers & EModifierCtrl ) |
|
668 , m_altKey( event.iModifiers & EModifierAlt ) |
|
669 , m_metaKey( EFalse ) // FIXME: Is this right? |
|
670 , m_symbianEvent(event) |
|
671 { |
|
672 |
|
673 TText c = event.iCode; |
|
674 m_text = String(TPtrC(&c,1)); |
|
675 m_unmodifiedText = String(TPtrC(&c,1));; // ### FIXME should do something else |
|
676 |
|
677 // Turn 0x7F into 8, because backspace needs to always be 8. |
|
678 if (m_text == "\x7F") |
|
679 { |
|
680 m_text = "\x8"; |
|
681 } |
|
682 if (m_unmodifiedText == "\x7F") |
|
683 { |
|
684 m_unmodifiedText = "\x8"; |
|
685 } |
|
686 // Always use 9 for tab -- we don't want to use AppKit's different character for shift-tab. |
|
687 if (m_WindowsKeyCode == 9) |
|
688 { |
|
689 m_text = "\x9"; |
|
690 m_unmodifiedText = "\x9"; |
|
691 } |
|
692 } |
|
693 |
|
694 } |
|
695 |