Fix the handling of dead keys on WASM
1) Do not attempt to take the first character of event.key when the key is a dead key - this always returns D as in Dead 2) Do not attempt to immediately modify the pressed key with the dead key as the dead key itself will be modified Pick-to: 6.5 Fixes: QTBUG-109629 Change-Id: Ic66536b8b27df23c2f1c4ebf1c02e713990e62ef Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
040b4a4b21
commit
988c7bfcae
@ -177,12 +177,15 @@ bool isDeadKeyEvent(const EmscriptenKeyboardEvent *emKeyEvent)
|
||||
|
||||
Qt::Key translateEmscriptKey(const EmscriptenKeyboardEvent *emscriptKey)
|
||||
{
|
||||
if (isDeadKeyEvent(emscriptKey)) {
|
||||
const bool deadKeyEvent = isDeadKeyEvent(emscriptKey);
|
||||
if (deadKeyEvent) {
|
||||
if (auto mapping = findMappingByBisection(emscriptKey->code))
|
||||
return *mapping;
|
||||
}
|
||||
if (auto mapping = findMappingByBisection(emscriptKey->key))
|
||||
return *mapping;
|
||||
if (deadKeyEvent)
|
||||
return Qt::Key_unknown;
|
||||
|
||||
// cast to unicode key
|
||||
QString str = QString::fromUtf8(emscriptKey->key).toUpper();
|
||||
@ -306,11 +309,9 @@ QWasmEventTranslator::translateKeyEvent(int emEventType, const EmscriptenKeyboar
|
||||
if (keyEvent->shiftKey && ret.key == Qt::Key_QuoteLeft)
|
||||
ret.key = Qt::Key_AsciiTilde;
|
||||
m_emDeadKey = ret.key;
|
||||
}
|
||||
|
||||
if (m_emDeadKey != Qt::Key_unknown
|
||||
&& (m_keyModifiedByDeadKeyOnPress == Qt::Key_unknown
|
||||
|| ret.key == m_keyModifiedByDeadKeyOnPress)) {
|
||||
} else if (m_emDeadKey != Qt::Key_unknown
|
||||
&& (m_keyModifiedByDeadKeyOnPress == Qt::Key_unknown
|
||||
|| ret.key == m_keyModifiedByDeadKeyOnPress)) {
|
||||
const Qt::Key baseKey = ret.key;
|
||||
const Qt::Key translatedKey = translateBaseKeyUsingDeadKey(baseKey, m_emDeadKey);
|
||||
if (translatedKey != Qt::Key_unknown)
|
||||
|
Loading…
x
Reference in New Issue
Block a user