The text input state has been changed to be window-specific.

SDL_StartTextInput(), SDL_StopTextInput(), SDL_TextInputActive(), SDL_ClearComposition(), and SDL_SetTextInputRect() all now take a window parameter.

This change also fixes IME candidate positioning when SDL_SetTextInputRect() is called before SDL_StartTextInput(), as is recommended in the documentation.
This commit is contained in:
Sam Lantinga 2024-06-22 06:16:19 -07:00
parent 258ee05655
commit 76631a0978
48 changed files with 361 additions and 339 deletions

View file

@ -29,7 +29,7 @@ typedef void (*SDL_IME_Quit_t)(void);
typedef void (*SDL_IME_SetFocus_t)(SDL_bool);
typedef void (*SDL_IME_Reset_t)(void);
typedef SDL_bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, Uint8 state);
typedef void (*SDL_IME_UpdateTextRect_t)(const SDL_Rect *);
typedef void (*SDL_IME_UpdateTextRect_t)(SDL_Window *window);
typedef void (*SDL_IME_PumpEvents_t)(void);
static SDL_IME_Init_t SDL_IME_Init_Real = NULL;
@ -135,10 +135,10 @@ SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
return SDL_FALSE;
}
void SDL_IME_UpdateTextRect(const SDL_Rect *rect)
void SDL_IME_UpdateTextRect(SDL_Window *window)
{
if (SDL_IME_UpdateTextRect_Real) {
SDL_IME_UpdateTextRect_Real(rect);
SDL_IME_UpdateTextRect_Real(window);
}
}