Fixed dead keys on MS Windows
Since Qt4, there is a bug which causes Qt to drop dead key modifiers (like graves and acutes) if the user types enough fast on MS Windows. This happens because of an extrange behavior of Windows, which drops dead keys on ToUnicode() calls. This patch tries to workaround that. Task-number: QTBUG-8764 Task-number: QTBUG-10032 Change-Id: Ifdde25817743194fd5c0b7533c27f46a7a108ca4 Reviewed-by: Friedemann.Kleint@digia.com Reviewed-by: oliver.wolff@digia.com Reviewed-by: marc.mutz@kdab.com Reviewed-by: bjoern.breitmeyer@kdab.com Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>bb10
parent
1161a8a629
commit
5d2bb24cc9
|
|
@ -856,9 +856,15 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
|
|||
if (isNumpad && (nModifiers & AltAny)) {
|
||||
code = winceKeyBend(msg.wParam);
|
||||
} else if (!isDeadKey) {
|
||||
unsigned char kbdBuffer[256]; // Will hold the complete keyboard state
|
||||
GetKeyboardState(kbdBuffer);
|
||||
code = toKeyOrUnicode(msg.wParam, scancode, kbdBuffer);
|
||||
// QTBUG-8764, QTBUG-10032
|
||||
// Can't call toKeyOrUnicode because that would call ToUnicode, and, if a dead key
|
||||
// is pressed at the moment, Windows would NOT use it to compose a character for the next
|
||||
// WM_CHAR event.
|
||||
|
||||
// Instead, use MapVirtualKey, which will provide adequate values.
|
||||
code = MapVirtualKey(msg.wParam, MAPVK_VK_TO_CHAR);
|
||||
if (code < 0x20 || code == 0x7f) // The same logic as in toKeyOrUnicode()
|
||||
code = winceKeyBend(msg.wParam);
|
||||
}
|
||||
|
||||
// Invert state logic:
|
||||
|
|
|
|||
Loading…
Reference in New Issue