summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorJuan Luis Boya GarcĂ­a <ntrrgc@gmail.com>2013-01-15 04:58:49 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-16 21:27:52 (GMT)
commit68331c5436506b6f9b4c2a49692a09020e4eef27 (patch)
treee7fc0b660cae30e1e62095163711149fef43bb42 /src/gui/kernel
parent6325c61b475e6560d23348a9dcb26e93c2713647 (diff)
downloadQt-68331c5436506b6f9b4c2a49692a09020e4eef27.zip
Qt-68331c5436506b6f9b4c2a49692a09020e4eef27.tar.gz
Qt-68331c5436506b6f9b4c2a49692a09020e4eef27.tar.bz2
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 Conflicts: src/plugins/platforms/windows/qwindowskeymapper.cpp Change-Id: Ifdde25817743194fd5c0b7533c27f46a7a108ca4 (cherry picked from commit 5d2bb24cc90194a3458f8741e30ae7afe0b45f5c) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qkeymapper_win.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp
index 5145699..b0931b0 100644
--- a/src/gui/kernel/qkeymapper_win.cpp
+++ b/src/gui/kernel/qkeymapper_win.cpp
@@ -925,9 +925,15 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
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: