From ce417a40cf4bdaa0185908f9c207043d72225444 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 6 Jul 2026 16:44:59 -0700 Subject: [PATCH] Start text input before showing the on-screen keyboard (thanks @sharkwouter!) Fixes the on screen keyboard not sending an event the first time on PSP Closes https://github.com/libsdl-org/SDL/pull/15950 --- src/video/SDL_video.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index c99e45216a..dfbd824b91 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -5836,15 +5836,8 @@ bool SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props _this->SetTextInputProperties(_this, window, props); } - // Show the on-screen keyboard, if desired - if (AutoShowingScreenKeyboard() && !SDL_ScreenKeyboardShown(window)) { - if (_this->ShowScreenKeyboard) { - _this->ShowScreenKeyboard(_this, window, props); - } - } - if (!window->text_input_active) { - // Finally start the text input system + // Start the text input system if (_this->StartTextInput) { if (!_this->StartTextInput(_this, window, props)) { return false; @@ -5852,6 +5845,13 @@ bool SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props } window->text_input_active = true; } + + // Show the on-screen keyboard, if desired + if (AutoShowingScreenKeyboard() && !SDL_ScreenKeyboardShown(window)) { + if (_this->ShowScreenKeyboard) { + _this->ShowScreenKeyboard(_this, window, props); + } + } return true; }