Text area input rect SDL2 iphone


#1

How do I prevent the rest of the window from sliding too far out of view when I open the text rect? Something’s buggy with the text rect right now on iphone.


#2

On iOS, SDL_SetTextInputRect sets the rectangle where your text is showing up in window-space coordinates. SDL will make sure the area covered by that rectangle is always visible even with the keyboard active (so it might push the window up if the keyboard was going to cover that area.)

Also make sure you?re using the latest SDL source code, since SDL 2.0.3 had some issues with the on-screen keyboard on modern iOS versions.> On Sep 28, 2015, at 2:55 AM, polyfrag wrote:

How do I prevent the rest of the window from sliding too far out of view when I open the text rect? Something’s buggy with the text rect right now on iphone.


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


#3

This still seems to be an issue.

I worked around this previously by doing my own offsetting but I thought I’d try it again with latest code (2.0.10).

On my iPad Pro it works correctly, the keyboard appears and my window slides up by the correct amount depending on where I set the rect.

On my iPhone X it slides up and off the screen leaving the visible area above the keyboard black.

I’m not doing anything different on iPad vs iPhone, it’s the same code.

This is in landscape mode, my app doesn’t work in portrait so I haven’t tested that.

Latest version of iOS on both devices.


#4

Err, so that’s me making a schoolboy error.

I was detecting a retina screen and halving the size of the RECT passed to the function…but I overlooked the fact that iPhone X has a scale factor of 3.0 not 2.0.