Skip to content

Request: SDL_StartTextInput should be called if Window.TextInputActive is true but SDL_TextInputActive isn't #46

@Demorome

Description

@Demorome

ImGui's official SDL3 backend calls SDL_StartTextInput and SDL_StopTextInput without care for our game's state:
https://github.com/ocornut/imgui/blob/21d3299e588b5c702dcca0f448b4f937af369b4a/backends/imgui_impl_sdl3.cpp#L210
https://github.com/ocornut/imgui/blob/21d3299e588b5c702dcca0f448b4f937af369b4a/backends/imgui_impl_sdl3.cpp#L191

This means if someone wants to use that convenient backend, they can suffer from a bug where Window.TextInputActive is true, but the text input state has in reality been turned off by the backend if ImGui happened to have also had active text input and then no longer needed it.

The only fix I can imagine for this would be to constantly loop over all windows to check if Window.TextInputActive is true, but SDL_TextInputActive isn't, and to call SDL_StartTextInput in such a case.
This logic would probably run in Game.ProcessSystemEvents, or somewhere close.


Alternatively, perhaps a warning could be placed on Window.TextInputActive for users using such a backend, to indicate that they should manually work around the issue by doing this check themselves in their Step function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions