Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SDL_StartTextInputWithProperties not updating input type on android #11448

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ public void run() {
mTextEdit.requestFocus();

InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.restartInput(mTextEdit);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it shouldn't be called every time. Restarting text input might cause UX problems. Maybe only call it if mTextEdit input type is changed.

imm.showSoftInput(mTextEdit, 0);

mScreenKeyboardShown = true;
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -5297,7 +5297,7 @@ bool SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props
}

// Show the on-screen keyboard, if desired
if (AutoShowingScreenKeyboard() && !SDL_ScreenKeyboardShown(window)) {
if (AutoShowingScreenKeyboard()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the SDL_ScreenKeyboardShown() check originally here? It was correct for SDL_StartTextInput(), but now that SDL_StartTextInputWithProperties() is a thing, this check no longer makes sense.

If the props have changed, ShowScreenKeyboard (or a new update method) should be called to communicate the updated keyboard type to the platform layer.

if (_this->ShowScreenKeyboard) {
_this->ShowScreenKeyboard(_this, window, props);
}
Expand Down
Loading