From fe4ab7edce3863a23d5871634d93f0b855aa93ac Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 16 Nov 2015 12:07:15 +0100 Subject: iOS: always flush spontaneous key press events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we changed sending key events through QPA instead of directly to the focus object, we only flushed from deleteBackward (06be9f026). The reason was to avoid unnecessary flushes, as this in general can be a source to recursion problems. It turns out that this is also needed when sending Qt::Key_Return. The reason is that we sometimes resign first responder when the return key is pressed, which will also change the focus object in Qt. And without flushing the key event first, it will be processed after the change and therefore end up at the wrong object. It seems like the most sensible thing is to always flush upon receiving spontaneous key/text events from iOS, which is also how it was before. Task-number: QTBUG-49021 Change-Id: I44885a11275dee5039ef6a8abbcbdadc092695e7 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index c9120e848c..f3ea68cdc4 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -329,6 +329,7 @@ { QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); + QWindowSystemInterface::flushWindowSystemEvents(); } #ifndef QT_NO_SHORTCUT @@ -875,7 +876,6 @@ // UITextInput selects the text to be deleted before calling this method. To avoid // drawing the selection, we flush after posting the key press/release. [self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier]; - QWindowSystemInterface::flushWindowSystemEvents(); } @end -- cgit v1.2.3