mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 20:09:38 +08:00
Work around password integrations hiding software keyboard and preventing autofill
This commit is contained in:
committed by
Sam Lantinga
parent
bd7d4708e3
commit
29cff6e264
@@ -554,6 +554,14 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
|
|
||||||
- (void)textFieldTextDidChange:(NSNotification *)notification
|
- (void)textFieldTextDidChange:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
|
// When opening a password manager overlay to select a password and have it auto-filled,
|
||||||
|
// text input becomes stopped as a result of the keyboard being hidden or the text field losing focus.
|
||||||
|
// As a workaround, ensure text input is activated on any changes to the text field.
|
||||||
|
bool startTextInputMomentarily = !SDL_TextInputActive(window);
|
||||||
|
|
||||||
|
if (startTextInputMomentarily)
|
||||||
|
SDL_StartTextInput(window);
|
||||||
|
|
||||||
if (textField.markedTextRange == nil) {
|
if (textField.markedTextRange == nil) {
|
||||||
NSUInteger compareLength = SDL_min(textField.text.length, committedText.length);
|
NSUInteger compareLength = SDL_min(textField.text.length, committedText.length);
|
||||||
NSUInteger matchLength;
|
NSUInteger matchLength;
|
||||||
@@ -588,6 +596,9 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
}
|
}
|
||||||
committedText = textField.text;
|
committedText = textField.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (startTextInputMomentarily)
|
||||||
|
SDL_StopTextInput(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateKeyboard
|
- (void)updateKeyboard
|
||||||
|
|||||||
Reference in New Issue
Block a user