win32: Fix text prediction with on screen keyboard

When the on-screen keyboard completes a word via text prediction, the
message contains VK_PACKET as identifier for a character sequence.
While each character is send, the code only contains the first character
of the sequence.
Hence, resolve the actual code manually in case of a sequence.
This does not modify the virtual key, so that users are able to
distinguish between manual and predictive input.

Fixes: QTBUG-71210
Change-Id: I787f1f2d83acaf124dfbbab6c4614a1bfe7bb2eb
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Maurice Kalinowski 2018-11-06 11:03:42 +01:00 committed by Liang Qi
parent 508b9b49b9
commit 6857cd60dd

View File

@ -1263,6 +1263,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
}
#endif // !QT_NO_SHORTCUT
key_recorder.storeKey(int(msg.wParam), a, state, text);
// QTBUG-71210
// VK_PACKET specifies multiple characters. The system only sends the first
// character of this sequence for each.
if (msg.wParam == VK_PACKET)
code = asciiToKeycode(char(uch.cell()), state);
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
modifiers, scancode, quint32(msg.wParam), nModifiers, text, false);
result =true;