Skip to content

IME Support for XNA and GL builds #652

Open
@SadPencil

Description

#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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions