Hi, folks. I’ve been having some inquiries from CJK players of my game on Windows, asking about IME text entry. I’m using the current latest SDL2, version 2.0.12, but I’m able to update it to other versions or apply patches, if necessary.
So far as I can tell, I’m doing everything in approximately the right way; calling
SDL_StartTextInput() when keyboard focus is moved to an (in-game) editable text widget, and
SDL_StopTextInput() when the keyboard focus leaves it, as well as setting
SDL_SetTextInputRect(). SDL_TEXTINPUT and SDL_TEXTEDITING events seem to come through as intended.
And it all works exactly as one would expect in Linux and Mac builds, with IME candidate list windows opening at the expected times and functioning correctly to allow entry of composed CJK unicode glyphs. But on Windows (testing with the Windows 10 standard Pinyin IME), the candidate list window just never opens, which is a big problem for a bunch of my players. Is this something that’s supposed to be working right now?
I found that if I disabled the initialisation of the uiless system (SDL_windowskeyboard.c:374, just don’t call
UILess_SetupSinks() and leave
videodata->ime_uiless set to SDL_FALSE), then I do get the Windows IME appearing at the correct times, but that probably unsurprisingly only works if the game is running in a window, not if it’s in fullscreen mode; I’m assuming that this isn’t really the way that the system is supposed to work (I assume that the UILess system is there explicitly so that it’ll work even in fullscreen contexts, where the window compositor isn’t going to composite another OS window over SDL’s windows)
Can anybody fill me in on how the system is intended to be used? The tutorial page on input methods is really thin, and I can’t find a demo program which shows exactly how IME is intended to be handled in SDL2, or I’d copy that.
May or may not be relevant, but my game is an OpenGL 3.3 game, using SDL for window management, input, and cross-platform multithreading support; we’re not using SDL’s built-in renderer.
Thanks in advance if anybody can provide any information!