path: root/src/plugins/platforms/ios/
diff options
authorTor Arne Vestbø <>2014-09-03 15:29:16 +0200
committerTor Arne Vestbø <>2014-09-20 11:53:28 +0200
commit6910b8a552de6f0cd98fdfa50620825d59d63363 (patch)
tree8b89386acf7e8fe0ed5fd4390099d028ab0dc0d9 /src/plugins/platforms/ios/
parent6e4dc7073a195a73d9002e48dc4e27eb6b354d1e (diff)
iOS: Refactor text input handling to standalone responder
Instead of coupling the visibility of the virtual keyboard to the first-responder status of the currently active QUIView, we now treat first-responder as a separate state, tied directly to QWindow activation. This fits better with the concept of first-responders in iOS, as a UIView can become first-responder without dealing with text input, eg when dealing with touch events or menu actions. The decision point on whether or not to show the virtual keyboard is then handled by implementing the conformsToProtocol method and selectively returning YES for the UIKeyInput protocol. iOS internally calls _requiresKeyboardWhenFirstResponder on the UIResponder to determine this, but since we can't override a private method (like WKContentView in WebKit does) we have to rely on the fact that the implementation of the method uses the protocol conformance to make its decision. Once the virtual keyboard is up, we then need to react to changes to its configuration, such as keyboard type or the type of return key. Normally this would be a simple call to [view reloadInputViews], but iOS will not reload the built-in keyboards unless the UIResponder returns YES for _requiresKeyboardResetOnReload. Since we again can't override this private method (like WebKit does), we work around it by taking advantage of the fact that iOS will treat any change to the first-responder as a reason to do a keyboard reset. By using a stand-alone UIResponder for text input we can init and destroy these responders as needed, so that every call to reloadInputViews will trigger a reset, as the responder has not been seen before. We keep track of changes to the input-method-query, and detect whether or not we need to bring up a new UIResponder for text handling. As part of this refactoring we now tie the visibility of the virtual keyboard to the presence of a focus object that has input-methods enabled. This means that we automatically will track changes to input-elements through the focus changes, and reconfigure or hide the keyboard as appropriate. As a result the hide() method of QInputMethod becomes a no-op on iOS. Change-Id: I4c4834df490bc8b0bac32aeedbd819780bd5aaba Reviewed-by: Richard Moe Gustavsen <>
Diffstat (limited to 'src/plugins/platforms/ios/')
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/ b/src/plugins/platforms/ios/
index ad9912a8d0..82f0bd91c4 100644
--- a/src/plugins/platforms/ios/
+++ b/src/plugins/platforms/ios/
@@ -27,6 +27,7 @@ OBJECTIVE_SOURCES = \ \ \ \
+ \
qiosintegration.h \
@@ -46,6 +47,7 @@ HEADERS = \
qiosclipboard.h \
quiaccessibilityelement.h \
qiosplatformaccessibility.h \
+ qiostextresponder.h \