• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "config.h"
29 #include "PlatformKeyboardEvent.h"
30 
31 #include "KeyboardCodes.h"
32 #include "NotImplemented.h"
33 
34 #include <ctype.h>
35 
36 #include <QKeyEvent>
37 
38 namespace WebCore {
39 
keyIdentifierForQtKeyCode(int keyCode)40 static String keyIdentifierForQtKeyCode(int keyCode)
41 {
42     switch (keyCode) {
43         case Qt::Key_Menu:
44         case Qt::Key_Alt:
45             return "Alt";
46         case Qt::Key_Clear:
47             return "Clear";
48         case Qt::Key_Down:
49             return "Down";
50         case Qt::Key_End:
51             return "End";
52         case Qt::Key_Return:
53         case Qt::Key_Enter:
54             return "Enter";
55         case Qt::Key_Execute:
56             return "Execute";
57         case Qt::Key_F1:
58             return "F1";
59         case Qt::Key_F2:
60             return "F2";
61         case Qt::Key_F3:
62             return "F3";
63         case Qt::Key_F4:
64             return "F4";
65         case Qt::Key_F5:
66             return "F5";
67         case Qt::Key_F6:
68             return "F6";
69         case Qt::Key_F7:
70             return "F7";
71         case Qt::Key_F8:
72             return "F8";
73         case Qt::Key_F9:
74             return "F9";
75         case Qt::Key_F10:
76             return "F10";
77         case Qt::Key_F11:
78             return "F11";
79         case Qt::Key_F12:
80             return "F12";
81         case Qt::Key_F13:
82             return "F13";
83         case Qt::Key_F14:
84             return "F14";
85         case Qt::Key_F15:
86             return "F15";
87         case Qt::Key_F16:
88             return "F16";
89         case Qt::Key_F17:
90             return "F17";
91         case Qt::Key_F18:
92             return "F18";
93         case Qt::Key_F19:
94             return "F19";
95         case Qt::Key_F20:
96             return "F20";
97         case Qt::Key_F21:
98             return "F21";
99         case Qt::Key_F22:
100             return "F22";
101         case Qt::Key_F23:
102             return "F23";
103         case Qt::Key_F24:
104             return "F24";
105         case Qt::Key_Help:
106             return "Help";
107         case Qt::Key_Home:
108             return "Home";
109         case Qt::Key_Insert:
110             return "Insert";
111         case Qt::Key_Left:
112             return "Left";
113         case Qt::Key_PageDown:
114             return "PageDown";
115         case Qt::Key_PageUp:
116             return "PageUp";
117         case Qt::Key_Pause:
118             return "Pause";
119         case Qt::Key_Print:
120             return "PrintScreen";
121         case Qt::Key_Right:
122             return "Right";
123         case Qt::Key_Select:
124             return "Select";
125         case Qt::Key_Up:
126             return "Up";
127             // Standard says that DEL becomes U+007F.
128         case Qt::Key_Delete:
129             return "U+007F";
130         case Qt::Key_Tab:
131             return "U+0009";
132         case Qt::Key_Backtab:
133             return "U+0009";
134         default:
135             return String::format("U+%04X", toupper(keyCode));
136     }
137 }
138 
windowsKeyCodeForKeyEvent(unsigned int keycode,bool isKeypad=false)139 static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false)
140 {
141     // Determine wheter the event comes from the keypad
142     if (isKeypad) {
143         switch (keycode) {
144         case Qt::Key_0:
145             return VK_NUMPAD0;  // (60) Numeric keypad 0 key
146         case Qt::Key_1:
147             return VK_NUMPAD1;  // (61) Numeric keypad 1 key
148         case Qt::Key_2:
149             return  VK_NUMPAD2; // (62) Numeric keypad 2 key
150         case Qt::Key_3:
151             return VK_NUMPAD3;  // (63) Numeric keypad 3 key
152         case Qt::Key_4:
153             return VK_NUMPAD4;  // (64) Numeric keypad 4 key
154         case Qt::Key_5:
155             return VK_NUMPAD5;  // (65) Numeric keypad 5 key
156         case Qt::Key_6:
157             return VK_NUMPAD6;  // (66) Numeric keypad 6 key
158         case Qt::Key_7:
159             return VK_NUMPAD7;  // (67) Numeric keypad 7 key
160         case Qt::Key_8:
161             return VK_NUMPAD8;  // (68) Numeric keypad 8 key
162         case Qt::Key_9:
163             return VK_NUMPAD9;  // (69) Numeric keypad 9 key
164         case Qt::Key_Asterisk:
165             return VK_MULTIPLY; // (6A) Multiply key
166         case Qt::Key_Plus:
167             return VK_ADD;      // (6B) Add key
168         case Qt::Key_Minus:
169             return VK_SUBTRACT; // (6D) Subtract key
170         case Qt::Key_Period:
171             return VK_DECIMAL;  // (6E) Decimal key
172         case Qt::Key_Slash:
173             return VK_DIVIDE;   // (6F) Divide key
174         case Qt::Key_PageUp:
175             return VK_PRIOR; // (21) PAGE UP key
176         case Qt::Key_PageDown:
177             return VK_NEXT; // (22) PAGE DOWN key
178         case Qt::Key_End:
179             return VK_END; // (23) END key
180         case Qt::Key_Home:
181             return VK_HOME; // (24) HOME key
182         case Qt::Key_Left:
183             return VK_LEFT; // (25) LEFT ARROW key
184         case Qt::Key_Up:
185             return VK_UP; // (26) UP ARROW key
186         case Qt::Key_Right:
187             return VK_RIGHT; // (27) RIGHT ARROW key
188         case Qt::Key_Down:
189             return VK_DOWN; // (28) DOWN ARROW key
190         default:
191             return 0;
192         }
193 
194     } else
195 
196     switch (keycode) {
197         case Qt::Key_Backspace:
198             return VK_BACK; // (08) BACKSPACE key
199         case Qt::Key_Backtab:
200         case Qt::Key_Tab:
201             return VK_TAB; // (09) TAB key
202         case Qt::Key_Clear:
203             return VK_CLEAR; // (0C) CLEAR key
204         case Qt::Key_Enter:
205         case Qt::Key_Return:
206             return VK_RETURN; //(0D) Return key
207         case Qt::Key_Shift:
208             return VK_SHIFT; // (10) SHIFT key
209         case Qt::Key_Control:
210             return VK_CONTROL; // (11) CTRL key
211         case Qt::Key_Menu:
212         case Qt::Key_Alt:
213             return VK_MENU; // (12) ALT key
214 
215         case Qt::Key_F1:
216             return VK_F1;
217         case Qt::Key_F2:
218             return VK_F2;
219         case Qt::Key_F3:
220             return VK_F3;
221         case Qt::Key_F4:
222             return VK_F4;
223         case Qt::Key_F5:
224             return VK_F5;
225         case Qt::Key_F6:
226             return VK_F6;
227         case Qt::Key_F7:
228             return VK_F7;
229         case Qt::Key_F8:
230             return VK_F8;
231         case Qt::Key_F9:
232             return VK_F9;
233         case Qt::Key_F10:
234             return VK_F10;
235         case Qt::Key_F11:
236             return VK_F11;
237         case Qt::Key_F12:
238             return VK_F12;
239         case Qt::Key_F13:
240             return VK_F13;
241         case Qt::Key_F14:
242             return VK_F14;
243         case Qt::Key_F15:
244             return VK_F15;
245         case Qt::Key_F16:
246             return VK_F16;
247         case Qt::Key_F17:
248             return VK_F17;
249         case Qt::Key_F18:
250             return VK_F18;
251         case Qt::Key_F19:
252             return VK_F19;
253         case Qt::Key_F20:
254             return VK_F20;
255         case Qt::Key_F21:
256             return VK_F21;
257         case Qt::Key_F22:
258             return VK_F22;
259         case Qt::Key_F23:
260             return VK_F23;
261         case Qt::Key_F24:
262             return VK_F24;
263 
264         case Qt::Key_Pause:
265             return VK_PAUSE; // (13) PAUSE key
266         case Qt::Key_CapsLock:
267             return VK_CAPITAL; // (14) CAPS LOCK key
268         case Qt::Key_Kana_Lock:
269         case Qt::Key_Kana_Shift:
270             return VK_KANA; // (15) Input Method Editor (IME) Kana mode
271         case Qt::Key_Hangul:
272             return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode
273             // VK_JUNJA (17) IME Junja mode
274             // VK_FINAL (18) IME final mode
275         case Qt::Key_Hangul_Hanja:
276             return VK_HANJA; // (19) IME Hanja mode
277         case Qt::Key_Kanji:
278             return VK_KANJI; // (19) IME Kanji mode
279         case Qt::Key_Escape:
280             return VK_ESCAPE; // (1B) ESC key
281             // VK_CONVERT (1C) IME convert
282             // VK_NONCONVERT (1D) IME nonconvert
283             // VK_ACCEPT (1E) IME accept
284             // VK_MODECHANGE (1F) IME mode change request
285         case Qt::Key_Space:
286             return VK_SPACE; // (20) SPACEBAR
287         case Qt::Key_PageUp:
288             return VK_PRIOR; // (21) PAGE UP key
289         case Qt::Key_PageDown:
290             return VK_NEXT; // (22) PAGE DOWN key
291         case Qt::Key_End:
292             return VK_END; // (23) END key
293         case Qt::Key_Home:
294             return VK_HOME; // (24) HOME key
295         case Qt::Key_Left:
296             return VK_LEFT; // (25) LEFT ARROW key
297         case Qt::Key_Up:
298             return VK_UP; // (26) UP ARROW key
299         case Qt::Key_Right:
300             return VK_RIGHT; // (27) RIGHT ARROW key
301         case Qt::Key_Down:
302             return VK_DOWN; // (28) DOWN ARROW key
303         case Qt::Key_Select:
304             return VK_SELECT; // (29) SELECT key
305         case Qt::Key_Print:
306             return VK_PRINT; // (2A) PRINT key
307         case Qt::Key_Execute:
308             return VK_EXECUTE;// (2B) EXECUTE key
309             //dunno on this
310             //case Qt::Key_PrintScreen:
311             //      return VK_SNAPSHOT; // (2C) PRINT SCREEN key
312         case Qt::Key_Insert:
313             return VK_INSERT; // (2D) INS key
314         case Qt::Key_Delete:
315             return VK_DELETE; // (2E) DEL key
316         case Qt::Key_Help:
317             return VK_HELP; // (2F) HELP key
318         case Qt::Key_0:
319         case Qt::Key_ParenLeft:
320             return VK_0;    //  (30) 0) key
321         case Qt::Key_1:
322             return VK_1; //  (31) 1 ! key
323         case Qt::Key_2:
324         case Qt::Key_At:
325             return VK_2; //  (32) 2 & key
326         case Qt::Key_3:
327         case Qt::Key_NumberSign:
328             return VK_3; //case '3': case '#';
329         case Qt::Key_4:
330         case Qt::Key_Dollar: //  (34) 4 key '$';
331             return VK_4;
332         case Qt::Key_5:
333         case Qt::Key_Percent:
334             return VK_5; //  (35) 5 key  '%'
335         case Qt::Key_6:
336         case Qt::Key_AsciiCircum:
337             return VK_6; //  (36) 6 key  '^'
338         case Qt::Key_7:
339         case Qt::Key_Ampersand:
340             return VK_7; //  (37) 7 key  case '&'
341         case Qt::Key_8:
342         case Qt::Key_Asterisk:
343             return VK_8; //  (38) 8 key  '*'
344         case Qt::Key_9:
345         case Qt::Key_ParenRight:
346             return VK_9; //  (39) 9 key '('
347         case Qt::Key_A:
348             return VK_A; //  (41) A key case 'a': case 'A': return 0x41;
349         case Qt::Key_B:
350             return VK_B; //  (42) B key case 'b': case 'B': return 0x42;
351         case Qt::Key_C:
352             return VK_C; //  (43) C key case 'c': case 'C': return 0x43;
353         case Qt::Key_D:
354             return VK_D; //  (44) D key case 'd': case 'D': return 0x44;
355         case Qt::Key_E:
356             return VK_E; //  (45) E key case 'e': case 'E': return 0x45;
357         case Qt::Key_F:
358             return VK_F; //  (46) F key case 'f': case 'F': return 0x46;
359         case Qt::Key_G:
360             return VK_G; //  (47) G key case 'g': case 'G': return 0x47;
361         case Qt::Key_H:
362             return VK_H; //  (48) H key case 'h': case 'H': return 0x48;
363         case Qt::Key_I:
364             return VK_I; //  (49) I key case 'i': case 'I': return 0x49;
365         case Qt::Key_J:
366             return VK_J; //  (4A) J key case 'j': case 'J': return 0x4A;
367         case Qt::Key_K:
368             return VK_K; //  (4B) K key case 'k': case 'K': return 0x4B;
369         case Qt::Key_L:
370             return VK_L; //  (4C) L key case 'l': case 'L': return 0x4C;
371         case Qt::Key_M:
372             return VK_M; //  (4D) M key case 'm': case 'M': return 0x4D;
373         case Qt::Key_N:
374             return VK_N; //  (4E) N key case 'n': case 'N': return 0x4E;
375         case Qt::Key_O:
376             return VK_O; //  (4F) O key case 'o': case 'O': return 0x4F;
377         case Qt::Key_P:
378             return VK_P; //  (50) P key case 'p': case 'P': return 0x50;
379         case Qt::Key_Q:
380             return VK_Q; //  (51) Q key case 'q': case 'Q': return 0x51;
381         case Qt::Key_R:
382             return VK_R; //  (52) R key case 'r': case 'R': return 0x52;
383         case Qt::Key_S:
384             return VK_S; //  (53) S key case 's': case 'S': return 0x53;
385         case Qt::Key_T:
386             return VK_T; //  (54) T key case 't': case 'T': return 0x54;
387         case Qt::Key_U:
388             return VK_U; //  (55) U key case 'u': case 'U': return 0x55;
389         case Qt::Key_V:
390             return VK_V; //  (56) V key case 'v': case 'V': return 0x56;
391         case Qt::Key_W:
392             return VK_W; //  (57) W key case 'w': case 'W': return 0x57;
393         case Qt::Key_X:
394             return VK_X; //  (58) X key case 'x': case 'X': return 0x58;
395         case Qt::Key_Y:
396             return VK_Y; //  (59) Y key case 'y': case 'Y': return 0x59;
397         case Qt::Key_Z:
398             return VK_Z; //  (5A) Z key case 'z': case 'Z': return 0x5A;
399         case Qt::Key_Meta:
400             return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
401         //case Qt::Key_Meta_R: FIXME: What to do here?
402         //    return VK_RWIN; // (5C) Right Windows key (Natural keyboard)
403             // VK_APPS (5D) Applications key (Natural keyboard)
404             // VK_SLEEP (5F) Computer Sleep key
405             // VK_SEPARATOR (6C) Separator key
406             // VK_SUBTRACT (6D) Subtract key
407             // VK_DECIMAL (6E) Decimal key
408             // VK_DIVIDE (6F) Divide key
409             // handled by key code above
410 
411         case Qt::Key_NumLock:
412             return VK_NUMLOCK; // (90) NUM LOCK key
413 
414         case Qt::Key_ScrollLock:
415             return VK_SCROLL; // (91) SCROLL LOCK key
416 
417             // VK_LSHIFT (A0) Left SHIFT key
418             // VK_RSHIFT (A1) Right SHIFT key
419             // VK_LCONTROL (A2) Left CONTROL key
420             // VK_RCONTROL (A3) Right CONTROL key
421             // VK_LMENU (A4) Left MENU key
422             // VK_RMENU (A5) Right MENU key
423             // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
424             // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
425             // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
426             // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
427             // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
428             // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
429             // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
430             // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
431             // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
432             // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
433             // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
434             // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
435             // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
436             // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
437             // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
438             // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
439             // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
440             // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
441 
442             // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
443         case Qt::Key_Semicolon:
444         case Qt::Key_Colon:
445             return VK_OEM_1; //case ';': case ':': return 0xBA;
446             // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
447         case Qt::Key_Plus:
448         case Qt::Key_Equal:
449             return VK_OEM_PLUS; //case '=': case '+': return 0xBB;
450             // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
451         case Qt::Key_Comma:
452         case Qt::Key_Less:
453             return VK_OEM_COMMA; //case ',': case '<': return 0xBC;
454             // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
455         case Qt::Key_Minus:
456         case Qt::Key_Underscore:
457             return VK_OEM_MINUS; //case '-': case '_': return 0xBD;
458             // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
459         case Qt::Key_Period:
460         case Qt::Key_Greater:
461             return VK_OEM_PERIOD; //case '.': case '>': return 0xBE;
462             // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
463         case Qt::Key_Slash:
464         case Qt::Key_Question:
465             return VK_OEM_2; //case '/': case '?': return 0xBF;
466             // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
467         case Qt::Key_AsciiTilde:
468         case Qt::Key_QuoteLeft:
469             return VK_OEM_3; //case '`': case '~': return 0xC0;
470             // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
471         case Qt::Key_BracketLeft:
472         case Qt::Key_BraceLeft:
473             return VK_OEM_4; //case '[': case '{': return 0xDB;
474             // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
475         case Qt::Key_Backslash:
476         case Qt::Key_Bar:
477             return VK_OEM_5; //case '\\': case '|': return 0xDC;
478             // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
479         case Qt::Key_BracketRight:
480         case Qt::Key_BraceRight:
481             return VK_OEM_6; // case ']': case '}': return 0xDD;
482             // 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
483         case Qt::Key_QuoteDbl:
484             return VK_OEM_7; // case '\'': case '"': return 0xDE;
485             // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
486             // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
487             // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
488             // 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
489             // VK_ATTN (F6) Attn key
490             // VK_CRSEL (F7) CrSel key
491             // VK_EXSEL (F8) ExSel key
492             // VK_EREOF (F9) Erase EOF key
493             // VK_PLAY (FA) Play key
494             // VK_ZOOM (FB) Zoom key
495             // VK_NONAME (FC) Reserved for future use
496             // VK_PA1 (FD) PA1 key
497             // VK_OEM_CLEAR (FE) Clear key
498         default:
499             return 0;
500     }
501 
502 }
503 
PlatformKeyboardEvent(QKeyEvent * event)504 PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
505 {
506     const int state = event->modifiers();
507     m_type = (event->type() == QEvent::KeyRelease) ? KeyUp : KeyDown;
508     m_text = event->text();
509     m_unmodifiedText = event->text(); // FIXME: not correct
510     m_keyIdentifier = keyIdentifierForQtKeyCode(event->key());
511     m_autoRepeat = event->isAutoRepeat();
512     m_ctrlKey = (state & Qt::ControlModifier) != 0;
513     m_altKey = (state & Qt::AltModifier) != 0;
514     m_metaKey = (state & Qt::MetaModifier) != 0;
515     m_isKeypad = (state & Qt::KeypadModifier) != 0;
516     m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), m_isKeypad);
517     m_nativeVirtualKeyCode = event->nativeVirtualKey();
518     m_shiftKey = (state & Qt::ShiftModifier) != 0 || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
519     m_qtEvent = event;
520 }
521 
disambiguateKeyDownEvent(Type type,bool)522 void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
523 {
524     // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.
525     ASSERT(m_type == KeyDown);
526     m_type = type;
527 
528     if (type == RawKeyDown) {
529         m_text = String();
530         m_unmodifiedText = String();
531     } else {
532         /*
533             When we receive shortcut events like Ctrl+V then the text in the QKeyEvent is
534             empty. If we're asked to disambiguate the event into a Char keyboard event,
535             we try to detect this situation and still set the text, to ensure that the
536             general event handling sends a key press event after this disambiguation.
537         */
538         if (m_text.isEmpty() && m_windowsVirtualKeyCode && m_qtEvent->key() < Qt::Key_Escape)
539             m_text.append(UChar(m_windowsVirtualKeyCode));
540 
541         m_keyIdentifier = String();
542         m_windowsVirtualKeyCode = 0;
543     }
544 }
545 
currentCapsLockState()546 bool PlatformKeyboardEvent::currentCapsLockState()
547 {
548     notImplemented();
549     return false;
550 }
551 
552 }
553 
554 // vim: ts=4 sw=4 et
555