Skip to content

Commit

Permalink
On most platforms, start text input on newly-created windows.
Browse files Browse the repository at this point in the history
SDL2 defaulted to text input _on_ for desktop platforms, SDL3 does not for any
platform.

Fixes #183.
  • Loading branch information
icculus committed Jan 22, 2025
1 parent 0af491c commit 2a9b84e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sdl2_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -6988,6 +6988,11 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
SDL_SetWindowData(window, PROP_WINDOW_PARENT_POINTER, parent);
}
}

#if !defined(SDL_PLATFORM_IOS) && !defined(SDL_PLATFORM_ANDROID) // (and maybe others...?)
SDL3_StartTextInput(window);
#endif

return window;
}

Expand Down
1 change: 1 addition & 0 deletions src/sdl3_syms.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ SDL3_SYM_PASSTHROUGH_RETCODE(bool,ShowSimpleMessageBox,(Uint32 a, const char *b,
SDL3_SYM(bool,ShowWindow,(SDL_Window *a),(a),return)
SDL3_SYM(void,SignalCondition,(SDL_Condition *a),(a),return)
SDL3_SYM(void,SignalSemaphore,(SDL_Semaphore *a),(a),return)
SDL3_SYM(bool,StartTextInput,(SDL_Window *a),(a),return)
SDL3_SYM(bool,StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return)
SDL3_SYM(bool,StopTextInput,(SDL_Window *a),(a),return)
SDL3_SYM(bool,SurfaceHasColorKey,(SDL_Surface *a),(a),return)
Expand Down

0 comments on commit 2a9b84e

Please sign in to comment.