Skip to content

Commit

Permalink
Enable text events for SDL3.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceLR committed Nov 4, 2024
1 parent f8e5b3a commit 35dca23
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/event_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,6 @@ void __warp_mouse(int x, int y)
*/
void sdl_init_window_text_events(unsigned sdl_window_id)
{
#if SDL_VERSION_ATLEAST(2,0,0)
/* Most platforms want text input events always on so they can generate
* convenient unicode text values, but in Android this causes some problems:
*
Expand All @@ -1739,6 +1738,17 @@ void sdl_init_window_text_events(unsigned sdl_window_id)
*
* TODO: Instead, enable text input on demand at text prompts.
*/
#if SDL_VERSION_ATLEAST(3,0,0)
#ifdef ANDROID
/* This is largely wishful thinking and needs thorough Android testing. */
#error See above comments.
#endif
SDL_Window *window = SDL_GetWindowFromID(sdl_window_id);
SDL_StopTextInput(window);
SDL_SetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD, "0");
SDL_StartTextInput(window);
unicode_fallback = false;
#elif SDL_VERSION_ATLEAST(2,0,0)
if(!SDL_HasScreenKeyboardSupport())
{
SDL_StartTextInput();
Expand Down

0 comments on commit 35dca23

Please sign in to comment.