Feature Request - IME Candidate List (Chinese/Japanese Input Support)

Using the events SDL_TEXTINPUT & SDL_TEXTEDITING it is possible to input characters using a windows supported IME. What I can’t seem to find is a way to retrieve a list of the IME candidates.

image

this candidates list is what I’m missing. To be able to see what is being written. I can still press “1” and retrieve the first suggestion, but right now I have no way to find what is being suggested before pressing it.

I was digging through the source code a bit and there do seem to be support for this for other devices, mainly mobile devices. I want to make a request for this feature for windows PC, as I can’t support mainly Asian communities without it.

Thanks,
Elis Jacobson

2 Likes

Seconded. There’s a relevant thread here and a bug report here but I’m not aware of any ongoing work to find a solution.

1 Like

I’ve actually posted a couple of threads about it, including the one that @rtrussell linked which included a simple cross-platform project that can be used to test SDL2’s IME support across different platforms. Never even got a reply to it; I suppose that if we want this sort of feature, we’re going to have to implement it ourselves and get folks to agree to merge it in.

On Mac and Linux, SDL2 already makes the OS display the OS’s own IME window when you’re in text entry mode, if your program is running in a non-fullscreen context. And with a very small patch to the Windows code (my memory is that it’s just commenting out one line of code in the SDL2 library), you can make that work on Windows as well.

But no desktop OS will composite their default IME candidate list over your game if your game is running in a fullscreen mode. And this is the real problem, from my point of view.

I sort of like the idea of drawing the IME candidate list inside the game itself, but SDL2 doesn’t currently have an API for “tell me all the IME options right now”, so it’s a case where somebody would need to figure out a good API for it and then implement it across all the various desktop platforms.

Are we even guaranteed that IMEs always work that way, as a numbered list of candidates? That’s definitely the convention, but are they allowed to be more freeform than that? By assuming that every IME works by showing an array of options, would we be shooting ourselves in the foot if one doesn’t work that way in future?

1 Like

Indeed, I don’t think any other solution will work, especially when the ‘game’ (i.e. any fullscreen application) could well be using direct OpenGL calls and bypassing the SDL2 renderer. The simplest option might be for the candidate list to be returned as a bitmap (e.g. a surface) which could easily be converted either to an SDL2 texture or an OpenGL texture, but I don’t know whether that would provide enough flexibility in formatting.

see this one: