lime icon indicating copy to clipboard operation
lime copied to clipboard

TextField IME candidate list pane invisible on Windows

Open tabris17 opened this issue 2 years ago • 8 comments

target is windows native

The cause of this issue is that the SDL version is too old.

openfl/libsdl/blob/master/src/video/windows/SDL_windowskeyboard.c

videodata->ime_uiless = UILess_SetupSinks(videodata);

This line of code causes the IME candidate pane to not be rendered. and this issue has been fixed in the latest version of SDL:

libsdl-org/SDL/blob/main/src/video/windows/SDL_windowskeyboard.c

if (WIN_ShouldShowNativeUI()) {
    videodata->ime_uiless = SDL_FALSE;
} else {
    videodata->ime_uiless = UILess_SetupSinks(videodata);
}

tabris17 avatar Feb 28 '24 02:02 tabris17

See #1684 for the work that's been done on this, though it does seem to have stalled.

player-03 avatar Feb 28 '24 03:02 player-03

Is it possible to fix openfl/libsdl with temporary patch?

The code below works fine on my windows system:

#if defined(__WIN32__)
videodata->ime_uiless = SDL_FALSE;
#else
videodata->ime_uiless = UILess_SetupSinks(videodata);
#endif

tabris17 avatar Feb 28 '24 03:02 tabris17

Sure, submit a PR.

player-03 avatar Feb 28 '24 03:02 player-03

It is probably worth mentioning that the 8.2.0-Dev branch switched from openfl/libsdl to libsdl-org/SDL. Any further changes that we make to openfl/libsdl will be lost with the Lime 8.2 update.

joshtynjala avatar Feb 28 '24 15:02 joshtynjala

However, I see that support for the Windows IME window was added in commit libsdl-org/SDL@6f972052296fdfe63ecaa7edab3e5b4e663eea06. I see that's part of SDL's release-2.0.18 tag. The 8.2.0-Dev branch appears to be on release-2.30.0, so this fix will be included in Lime 8.2 already.

joshtynjala avatar Feb 28 '24 16:02 joshtynjala

Oh whoops, I got the dates wrong. I thought 8.2.0-Dev didn't have the fix, so I didn't mention it.

player-03 avatar Feb 28 '24 16:02 player-03

I have tried 8.2.0-Dev branch and found that SDL_HINT_IME_SHOW_UI is not enable by default.

The following code needs to be added to the SDLWindow::SDLWindow() function to display the IME candidate list:

#if defined (HX_WINDOWS)
SDL_SetHint (SDL_HINT_IME_SHOW_UI, "1");
#endif

tabris17 avatar Feb 29 '24 05:02 tabris17

That feels like something most users won't need.

But SDL_SetHint() is declared extern; I wonder if that means you can get at it using CFFI? Then you'd be able to set whatever hints you needed. Sadly I don't know enough about CFFI to say for sure.

player-03 avatar Mar 04 '24 21:03 player-03