From 58ea69aaab62f31247dcd9b12f55de8fc001ea3a Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Sun, 23 Apr 2023 13:39:02 +0200 Subject: [PATCH] iOS: Ignore next touch event if keyboard has lost focus during touch If the iOS virtual keyboard as lost focus because it was slided down, the next touch event on an inactive screen area will be mapped to the keyboard. This kicks an assertion, because the keyboard is expected to be visible. The case that the keyboard has been deactivated by sliding it down is not covered. This patch replaces the assertion by setting self.enabled to NO, which reflects the keyboard deactivation. Fixes: QTBUG-112246 Pick-to: 6.6 6.5 6.2 Change-Id: I4873b7a702178acfd3cb8c988134facc050d642a Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/ios/qiosinputcontext.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 7a76760638..ac482226e9 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -174,7 +174,11 @@ static QUIView *focusView() { [super touchesBegan:touches withEvent:event]; - Q_ASSERT(m_context->isInputPanelVisible()); + if (!m_context->isInputPanelVisible()) { + qImDebug("keyboard was hidden by sliding it down, disabling hide-keyboard gesture"); + self.enabled = NO; + return; + } if ([touches count] != 1) self.state = UIGestureRecognizerStateFailed;