Screen keyboard API (iOS and Android change)

The iOS screen keyboard API was generalized by Philipp Wiesemann and
implemented on Android. I converted the existing iOS functions to the new
set:

SDL_bool SDL_HasScreenKeyboardSupport(SDL_Window * window)
– returns whether or not the onscreen keyboard is available for
the given window.
int SDL_ShowScreenKeyboard(SDL_Window * window)
– reveals the onscreen keyboard. Returns 0 on success and -1 on
error.
int SDL_HideScreenKeyboard(SDL_Window * window)
– hides the onscreen keyboard. Returns 0 on success and -1 on
error.
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window * window)
– returns whether or not the onscreen keyboard is currently
visible.
int SDL_ToggleScreenKeyboard(SDL_Window * window)
– toggles the visibility of the onscreen keyboard. Returns 0 on
success and -1 on error.

Cheers!

This needs further generalization I think. Pretty much all OSes allow keyboard type customization - special keyboards for numeric-only, email, etc. input.

There is a hint now that seems available only for Game Dev Kit
SDL_HINT_GDK_TEXTINPUT_SCOPE with GameDK specific magic values, stringified versions of these:

enum class XGameUiTextEntryInputScope : uint32_t  
{  
    Default = 0,  
    Url = 1,  
    EmailSmtpAddress = 5,  
    Number = 29,  
    Password = 31,  
    TelephoneNumber = 32,  
    Alphanumeric = 40,  
    Search = 50,
    ChatWithoutEmoji = 68
}

I believe that instead we should have SDL_HINT_TEXTINPUT_KEYBOARD with the following types:

  • “”, “text”
  • “url”
  • “email”
  • “number”
  • “password”
  • “telephone”,
  • “alphanumeric”

The hint may also have modifiers:

  • “,multiline”
  • “,emoji”
  • “,lang={iso-type}” - default language
2 Likes