From 6ad06e00a4e46da2fe4b832698df21bc6035ce66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 8 Mar 2026 13:03:00 +0100 Subject: [PATCH] iOS: Close the keyboard on one more event. Makes it easier to get rid of it if it gets stuck. --- Common/System/System.h | 1 + Common/UI/UIScreen.cpp | 4 ++++ Common/UI/UIScreen.h | 1 + ios/ViewControllerCommon.mm | 1 + ios/main.mm | 1 + 5 files changed, 8 insertions(+) diff --git a/Common/System/System.h b/Common/System/System.h index 081227589f..238ae47e25 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -61,6 +61,7 @@ void System_LaunchUrl(LaunchUrlType urlType, std::string_view url); enum class UIEventNotification { MENU_RETURN, POPUP_CLOSED, + DIALOG_CLOSED, TEXT_GOTFOCUS, TEXT_LOSTFOCUS, }; diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index 9cd40c855c..0e76c0f93f 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -264,6 +264,10 @@ void UIDialogScreen::sendMessage(UIMessage message, const char *value) { } } +UIDialogScreen::~UIDialogScreen() { + System_NotifyUIEvent(UIEventNotification::DIALOG_CLOSED); +} + bool UIScreen::IsOnTop() const { return screenManager()->topScreen() == this; } diff --git a/Common/UI/UIScreen.h b/Common/UI/UIScreen.h index d6da24e478..a6c09202cd 100644 --- a/Common/UI/UIScreen.h +++ b/Common/UI/UIScreen.h @@ -91,6 +91,7 @@ private: class UIDialogScreen : public UIScreen { public: UIDialogScreen() : UIScreen(), finished_(false) {} + ~UIDialogScreen() override; bool key(const KeyInput &key) override; void sendMessage(UIMessage message, const char *value) override; diff --git a/ios/ViewControllerCommon.mm b/ios/ViewControllerCommon.mm index b7eae300bf..ccf3ef3806 100644 --- a/ios/ViewControllerCommon.mm +++ b/ios/ViewControllerCommon.mm @@ -209,6 +209,7 @@ } [picker dismissViewControllerAnimated:YES completion:nil]; + [self hideKeyboard]; } diff --git a/ios/main.mm b/ios/main.mm index b442521084..75e5ef497b 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -533,6 +533,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string { switch ((UIEventNotification)param3) { case UIEventNotification::POPUP_CLOSED: + case UIEventNotification::DIALOG_CLOSED: [sharedViewController hideKeyboard]; break; case UIEventNotification::TEXT_GOTFOCUS: