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 committed 2024-06-24 11:20:08 -07:00
1 parent 258ee05655
commit 76631a0978
48 files changed
+361 -339

No files matched your search

+1 -9
View File
@@ -345,8 +345,7 @@ SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
{
SDL_VideoData *videodata = _this->driverdata;
Android_JNI_ShowScreenKeyboard(&videodata->textRect);
Android_JNI_ShowScreenKeyboard(&window->text_input_rect);
SDL_screen_keyboard_shown = SDL_TRUE;
}
@@ -368,11 +367,4 @@ SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *windo
return Android_JNI_IsScreenKeyboardShown();
}
int Android_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect)
{
SDL_VideoData *videodata = _this->driverdata;
videodata->textRect = *rect;
return 0;
}
#endif /* SDL_VIDEO_DRIVER_ANDROID */
-1
View File
@@ -30,4 +30,3 @@ extern void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *windo
extern void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window);
extern SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
extern int Android_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);
-3
View File
@@ -143,9 +143,6 @@ static SDL_VideoDevice *Android_CreateDevice(void)
/* Screensaver */
device->SuspendScreenSaver = Android_SuspendScreenSaver;
/* Text input */
device->SetTextInputRect = Android_SetTextInputRect;
/* Screen keyboard */
device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport;
device->ShowScreenKeyboard = Android_ShowScreenKeyboard;
-1
View File
@@ -35,7 +35,6 @@ extern void Android_SetDarkMode(SDL_bool enabled);
struct SDL_VideoData
{
SDL_Rect textRect;
int isPaused;
int isPausing;
int pauseAudio;