sdl: Respect text input main thread requirements. (#2138)

This commit is contained in:
squidbus 2025-01-12 12:44:42 -08:00 committed by GitHub
parent 4f2f9494b0
commit 4719d32295
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 28 deletions

View file

@ -205,7 +205,9 @@ void WindowSDL::InitTimers() {
void WindowSDL::RequestKeyboard() {
if (keyboard_grab == 0) {
SDL_StartTextInput(window);
SDL_RunOnMainThread(
[](void* userdata) { SDL_StartTextInput(static_cast<SDL_Window*>(userdata)); }, window,
true);
}
keyboard_grab++;
}
@ -214,7 +216,9 @@ void WindowSDL::ReleaseKeyboard() {
ASSERT(keyboard_grab > 0);
keyboard_grab--;
if (keyboard_grab == 0) {
SDL_StopTextInput(window);
SDL_RunOnMainThread(
[](void* userdata) { SDL_StopTextInput(static_cast<SDL_Window*>(userdata)); }, window,
true);
}
}