Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IME Support for XNA and GL builds #652

Open
SadPencil opened this issue Feb 2, 2025 · 0 comments
Open

IME Support for XNA and GL builds #652

SadPencil opened this issue Feb 2, 2025 · 0 comments

Comments

@SadPencil
Copy link
Member

SadPencil commented Feb 2, 2025

#537 introduced IME support for the DX build. IME Support for XNA and GL builds is missing, based on the following reasons:

  • The support for XNA build is implemented but disabled due to the observation of occasional crashes (See Remove IME related codes in XNA KeyboardEventInput Rampastring/Rampastring.XNAUI#37 for more details). However, since XNAUI has merged this PR, this type of crash might be fixed. if there are sufficient tests showing that the crash does not exist (note: you have to replace DummyIMEHandler with WinFormsIMEHandler before testing, and type Chinese words really really fast), we can resume the IME support for XNA build.
    public static IMEHandler Create(Game game)
    {
#if DX
        return new WinFormsIMEHandler(game);
#elif XNA
        // Warning: Think carefully before enabling WinFormsIMEHandler for XNA builds!
        // It *might* occasionally crash due to an unknown stack overflow issue.
        // This *might* be caused by both ImeSharp and XNAUI hooking into WndProc.
        // ImeSharp: https://github.com/ryancheung/ImeSharp/blob/dc2243beff9ef48eb37e398c506c905c965f8e68/ImeSharp/InputMethod.cs#L170
        // XNAUI: https://github.com/Rampastring/Rampastring.XNAUI/blob/9a7d5bb3e47ea50286ee05073d0a6723bc6d764d/Input/KeyboardEventInput.cs#L79
        //
        // That said, you can try returning a WinFormsIMEHandler and test if it is stable enough now. Who knows?
        return new DummyIMEHandler();
#elif GL
        return new SdlIMEHandler(game);
#else
#error Unknown variant
#endif
    }
  • The support for GL builds is not implemented. There is an empty SdlIMEHandler class acting as a placeholder for future implementation, and therefore please feel free to implement one and propose a PR. "MonoGame does not offer an API to hook into the external SDL2 message loop." in Add IME Support for DX and XNA Rampastring/Rampastring.XNAUI#32.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant