libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.95k stars 1.84k forks source link

IME improvements proposal #4331

Closed isage closed 1 year ago

isage commented 3 years ago

There are platforms (psvita / switch), where on-screen keyboard takes whole screen and have no way to provide SDL_TEXTEDITING event. Instead, those support setting initial text and dialog title. They also allow to set dialog type (e.g. text, numeric, etc.)

Proposal is to have something like SDL_StartTextInputAdvanced(const char* title, const char* initial_text, SDL_ImeType type); That also requires different from SDL_TEXTINPUT event, because SDL_TEXTINPUT works properly only in conjunction with SDL_TEXTEDITING.

This was requested by devilutionX developers, so here's real life usage example: When creating new player character, engine generates initial name for it, which player can change. Problem 1: right now it's impossible to pass such name to OSK. Problem 2: After user finishes text input in OSK, OSK sends SDL_TEXTINPUT event with whole text. So while on desktop platforms this works well, because there's SDL_TEXTEDITING event, and if user removed/edited initial name - that's handled, on vita and switch that leads to text from OSK being appended to initial player name instead, as engine doesn't/can't know if initial name was edited/removed.

slouken commented 3 years ago

Do you have a proposed patch that implements this, and a test program to verify it?

isage commented 3 years ago

Nope

icculus commented 3 years ago

This is bumping out of 2.0.18, but I would like to do something like this for the Switch branch sooner than later, so I might take a stab at it for 2.0.20.

slouken commented 1 year ago

SDL 2.0 is now in maintenance mode, and all inactive issues are being closed. If this issue is impacting you, please feel free to reopen it with additional information.