diff options
author | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2016-05-23 15:35:17 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2016-05-24 12:32:22 +0000 |
commit | 17a4384d120e8bc242f2f0d6c3559609e7547030 (patch) | |
tree | 860630c6d24f1b4a7c19c862f3333655cad2ef03 | |
parent | b092f681cf571a1c3068007d1a46633e5ab8b52f (diff) |
iOS: ensure we don't break UIKit IM state when sending key events
We need to be careful about calling textDidChange on the input
delegate, since that will reset the internal IM state in UIKit
and stop any ongoing text composition or spell checking.
For that reason we set m_inSendEventToFocusObject to true whenever
we send an IM event to Qt, to not call the abovementioned method when
callbacks from UIKit is the reason for changing the text.
But until now we never applied the same protection for key events.
This lead to ligatures not working correctly (e.g when using Korean
IM), since UIKit composes ligatures by first selecting the characters
that can be truncated, then do a deleteBackwards, then insert the ligature.
And deleteBackwards leads us to send backspace key events, which
ends up in a textDidChange call, which confuses UIKit.
This patch will ensure we don't call textDidChange as a result of
sending key events.
Task-number: QTBUG-52486
Change-Id: Ida268edae517f55a5b5f975340a5d3821f7b8f52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
-rw-r--r-- | src/plugins/platforms/ios/qiostextresponder.mm | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 320b1cac61..0cf505930f 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -353,6 +353,7 @@ - (void)sendKeyPressRelease:(Qt::Key)key modifiers:(Qt::KeyboardModifiers)modifiers { + QScopedValueRollback<BOOL> rollback(m_inSendEventToFocusObject, true); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); QWindowSystemInterface::flushWindowSystemEvents(); |