Added support for Bluetooth keyboards on iOS
authorSam Lantinga <slouken@libsdl.org>
Mon, 20 May 2019 14:31:03 -0700
changeset 12745c82ce49419a5
parent 12744 cbd7a9f0a05e
child 12746 132a2af7edac
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
     1.1 --- a/src/video/uikit/SDL_uikitviewcontroller.m	Mon May 20 14:08:35 2019 -0700
     1.2 +++ b/src/video/uikit/SDL_uikitviewcontroller.m	Mon May 20 14:31:03 2019 -0700
     1.3 @@ -73,6 +73,7 @@
     1.4  
     1.5  #if SDL_IPHONE_KEYBOARD
     1.6      UITextField *textField;
     1.7 +    BOOL showingKeyboard;
     1.8      BOOL rotatingOrientation;
     1.9      NSString *changeText;
    1.10      NSString *obligateForBackspace;
    1.11 @@ -328,7 +329,9 @@
    1.12  {
    1.13      keyboardVisible = YES;
    1.14      if (textField.window) {
    1.15 +        showingKeyboard = YES;
    1.16          [textField becomeFirstResponder];
    1.17 +        showingKeyboard = NO;
    1.18      }
    1.19  }
    1.20  
    1.21 @@ -354,7 +357,7 @@
    1.22  
    1.23  - (void)keyboardWillHide:(NSNotification *)notification
    1.24  {
    1.25 -    if (!rotatingOrientation) {
    1.26 +    if (!showingKeyboard && !rotatingOrientation) {
    1.27          SDL_StopTextInput();
    1.28      }
    1.29      [self setKeyboardHeight:0];