diff --git a/ios/SDL2/include/SDL_hints.h b/ios/SDL2/include/SDL_hints.h index 007a4be..5fcb0ff 100644 --- a/ios/SDL2/include/SDL_hints.h +++ b/ios/SDL2/include/SDL_hints.h @@ -746,6 +746,17 @@ extern "C" { #define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" /** + * \brief A variable to control whether the return key on the soft keyboard should hide the + * soft keyboard on iOS. + * + * The variable can be set to the following values: + * "0" - The return key will hide the keyboard. (default) + * "1" - The return key will be handled as a key event. + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_IOS_RETURN_HIDES_IME "SDL_IOS_RETURN_HIDES_IME" + +/** * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. * * The variable can be set to the following values: diff --git a/ios/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/ios/SDL2/src/video/uikit/SDL_uikitviewcontroller.m index 745e223..d391cb4 100644 --- a/ios/SDL2/src/video/uikit/SDL_uikitviewcontroller.m +++ b/ios/SDL2/src/video/uikit/SDL_uikitviewcontroller.m @@ -387,7 +387,9 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); - SDL_StopTextInput(); + if (!SDL_GetHintBoolean(SDL_HINT_IOS_RETURN_HIDES_IME, SDL_FALSE)) { + SDL_StopTextInput(); + } return YES; }