lagrange
lagrange copied to clipboard
IME at wrong position
In order to type Chinese or Japanese text an Input Method Editor (IME) is required. It looks like SDL already does most of the heavy lifting and provides said editor. But as lagrange does not provide SDL with information where to open the IME, the position is incorrect, see the attached screenshot:

It looks like SDL_SetTextInputRect can be used to set the correct position.
I added the calls to SDL_SetTextInputRect (abe38195588660abc717f13454d8dd28e425fd9). Let's see if that helps.
That does help! It is not quite perfect yet, for example here the position is still off:
and the IME should be placed under the cursor not the input field:

And one more thing: Typically you can either let the IME handle all text editing (rendering a little text field with a cursor in a separate window) or do it yourself and the IME only displays possible candidates to select (SDL's default), in which case SDL_TextEditingEvents have to be handled.
It looks like this can be used to let the IME handle text editing, which is most likely easier than handling new events:
SDL_SetHint(SDL_HINT_IME_INTERNAL_EDITING, "1");
See comment: https://github.com/skyjake/lagrange/issues/417#issuecomment-985511677