summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuan Luis Boya GarcĂ­a <ntrrgc@gmail.com>2013-01-15 05:58:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-16 08:53:58 +0100
commit5d2bb24cc90194a3458f8741e30ae7afe0b45f5c (patch)
treee7d8d5e3ab667393047eca407cc8c0cc44b40d2f /src
parent1161a8a62907796ea45b1877bec31e66aeef77f6 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 5a11aee802..f64593badc 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -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: