ITADN

It should be possible to enable SDL text input events (SDL_TextInputEvent) without using SDL_StartTextInput()

#15909Closedell1e 创建于 2026-06-30
E
ell1ecommented
I would like to propose that it should be possible to enable SDL text input events (SDL_TextInputEvent) without using SDL_StartTextInput(). According to the wiki, this isn't possible right now: https://wiki.libsdl.org/SDL3/SDL_TextInputEvent Quote: `This event will never be delivered unless text input is enabled by calling [SDL_StartTextInput](https://wiki.libsdl.org/SDL3/SDL_StartTextInput)(). Text input is disabled by default!` Here's why: - The regular key system SDL3 provides is fundamentally flawed for international input. Many constants are molded after US ANSI rather than generic layouts, like for example some keyboards have a key with an umlaut letter on the label, for which the key code list https://wiki.libsdl.org/SDL2/SDL_KeyCode has no equivalent. - User-chosen shortcuts shouldn't be limited to non-international keys if there is no good inherent reason for that limit. - The text input events can be used for shortcuts from the perspective of an app coder, as long as modifiers are somehow processed separately using the key code system. It's not the easiest way to do things, but it's certainly feasible. - However, here comes the catch: SDL_StartTextInput() has semantic implications. Most importantly, on touch devices, it will typically bring up the on-screen keyboard, and various parts of the system will assume that a text input widget has the focus. This doesn't line up with the general requirement to process keyboard shortcuts even when no text input widget is focused. Therefore, it would be nice if there was an independent way to always keep text input events enabled even when SDL_StartTextInput() wasn't used yet or SDL_StopTextInput() has been used. A good way to opt into such behavior might be adding a new SDL hint. If SDL has any suppression for text input based on modifiers, that suppression should be disabled by such a hint as well (such that CTRL+C will result in "C" being sent as a text input event).
关闭于 2026-07-01 5 条评论