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

SDL_SetTextInputRect has no effect on iOS #1194

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL_SetTextInputRect has no effect on iOS #1194

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.1
Reported for operating system, platform: iOS 6, ARM

Comments on the original bug report:

On 2013-11-06 15:50:50 +0000, philhassey wrote:

Overview: While SDL_SetTextInputRect works perfectly to move my window out of the way of the virtual keyboard using SDL2/Android, on iOS this function has no effect.

Steps to Reproduce: Call SDL_SetTextInputRect with a rect near the bottom of the screen before calling SDL_StartTextInput.

Actual Results: The iOS virtual keyboard is displayed after calling SDL_StartTextInput, but the screen is not shifted to reveal the TextInputRect region.

Expected Results: The screen should be shifted to reveal the TextInputRect region (like with SDL2/Android.)

Build Date & Hardware: SDL 2.0.1, iOS 6.1.3, iPad 3rd Gen.

Additional Builds and Platforms: Don't know.

Additional Information: I was able to workaround this bug in my own code by using iOS calls to get the height of the virtual keyboard when it was displayed and shifting my own screen. I would prefer if this was part of SDL2 though.

To find the height of the screen you must addObservers for UIKeyboardWillShowNotification and UIKeyboardDidHideNotification. From the former, you can get the height/width of the keyboard using UIKeyboardFrameBeginUserInfoKey. Then pick height or width based on statusBarOrientation. Finally you must multiply by the mainScreen scale.

On 2013-11-11 01:22:29 +0000, Sam Lantinga wrote:

I'm not sure how we'd do this on iOS. Any ideas?

On 2013-11-11 17:43:01 +0000, philhassey wrote:

Created attachment 1417
Patch to implement SDL_SteTextInputRect for uikit/iOS.

This patch implements SDL_SetTextInputRect for uikit/iOS.

It sets up notification handlers to respond to changes in the display of the keyboard. These handlers then change the frame of the view so it is moved out of the way of the keyboard as per SetTextInputRect.

On 2013-11-12 04:51:45 +0000, Sam Lantinga wrote:

Great work, thanks!
https://hg.libsdl.org/SDL/rev/e4d2f3375868

On 2015-02-24 17:07:20 +0000, philhassey wrote:

Created attachment 2050
Patch to add iOS 8 support for SDL_SetTextInputRect

I've updated this patch to add support for iOS 8. iOS 8 changed how coordinate systems worked, so the keyboard was opening improperly on all iOS 8 devices.

-Phil

On 2015-02-24 17:09:57 +0000, philhassey wrote:

I've re-opened this issue because my original patch only worked for iOS <= 7. This patch now supports 7 and 8.

On 2015-02-24 19:44:08 +0000, Alex Szpakowski wrote:

My large iOS improvement patch (https://bugzilla.libsdl.org/show_bug.cgi?id=2798) also contains a fix for this on iOS 8+.

On 2015-04-10 02:44:59 +0000, Ryan C. Gordon wrote:

This bug should be fixed by the changes made for Bug # 2798. Please reopen if that's not the case.

Thanks!

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant