summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-08-25 15:44:21 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-08-27 00:29:08 +0200
commitabdd52451978478234c2ae4d2a002c82e9d4b5fe (patch)
treeff10f283cf5db7f2567f3c0a8ee4126f62fa2c76 /src
parent294e4c7aa8cacd63c01d3836ce06c1f2d8c5ad5c (diff)
macOS: Check NSEvent.characters to determine dead key state
We map NSEvent.characters to text that we pass on in our QKeyEvent, but for Qt 4 compatibility we explicitly skip function keys and arrow keys, as the text these events produce are control characters. See 4dbce2a469608194527188a136baa3e812caf361. However, these keys are not dead keys, so we can't use the resolved text we're planning to pass on to Qt to determine if they are. Pick-to: 6.2 Change-Id: Ib59f0489ae014379c699600f14634c55161ccc8a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qnsview_keys.mm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_keys.mm b/src/plugins/platforms/cocoa/qnsview_keys.mm
index 9fcd30d5d8..9ff3a8a762 100644
--- a/src/plugins/platforms/cocoa/qnsview_keys.mm
+++ b/src/plugins/platforms/cocoa/qnsview_keys.mm
@@ -118,7 +118,8 @@
auto hints = static_cast<Qt::InputMethodHints>(queryResult.value(Qt::ImHints).toUInt());
// Make sure we send dead keys and the next key to the input method for composition
- const bool ignoreHidden = (hints & Qt::ImhHiddenText) && !text.isEmpty() && !m_lastKeyDead;
+ const bool isDeadKey = !nsevent.characters.length;
+ const bool ignoreHidden = (hints & Qt::ImhHiddenText) && !isDeadKey && !m_lastKeyDead;
if (!(hints & Qt::ImhDigitsOnly || hints & Qt::ImhFormattedNumbersOnly || ignoreHidden)) {
// Pass the key event to the input method. Note that m_sendKeyEvent may be set
@@ -139,7 +140,7 @@
// If the last key we sent was dead, then pass the next
// key to the IM as well to complete composition.
- m_lastKeyDead = text.isEmpty();
+ m_lastKeyDead = isDeadKey;
}
}