From a4e33b9cc45a0f40cbcd6ec80c3ab7c29fe99a5a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 May 2019 14:31:03 -0700 Subject: [PATCH] Added support for Bluetooth keyboards on iOS In this case the keyboard is shown and immediately hidden, but we still want to accept text input --- src/video/uikit/SDL_uikitviewcontroller.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index a4ee7efb08592..0e43cb68c9bbd 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -73,6 +73,7 @@ @implementation SDL_uikitviewcontroller { #if SDL_IPHONE_KEYBOARD UITextField *textField; + BOOL showingKeyboard; BOOL rotatingOrientation; NSString *changeText; NSString *obligateForBackspace; @@ -328,7 +329,9 @@ - (void)showKeyboard { keyboardVisible = YES; if (textField.window) { + showingKeyboard = YES; [textField becomeFirstResponder]; + showingKeyboard = NO; } } @@ -354,7 +357,7 @@ - (void)keyboardWillShow:(NSNotification *)notification - (void)keyboardWillHide:(NSNotification *)notification { - if (!rotatingOrientation) { + if (!showingKeyboard && !rotatingOrientation) { SDL_StopTextInput(); } [self setKeyboardHeight:0];