Feature request, getting the screen size of the keyboard

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature request, getting the screen size of the keyboard

EternalLands
Is there a way to get the size of the OSD keyboard on touch based devices?
The reason I am asking is that I would like to know where to show the user input text, and some keyboards are larger than others (plus, many keyboards can have a size set by the user).
I am interested mainly for Android, although it would be nice to have a universal function.

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request, getting the screen size of the keyboard

hardcoredaniel
It is a while ago that I looked into this, but I believe you will get a window event (like resized or size changed) that tells you the new window size that you can render on, while the keyboard is shown. From that you can compute the size of the keyboard.


---------- Původní zpráva ----------
Od: EternalLands <[hidden email]>
Komu: [hidden email]
Datum: 5. 1. 2017 16:59:38
Předmět: [SDL] Feature request, getting the screen size of the keyboard


Is there a way to get the size of the OSD keyboard on touch based devices?
The reason I am asking is that I would like to know where to show the user input text, and some keyboards are larger than others (plus, many keyboards can have a size set by the user).
I am interested mainly for Android, although it would be nice to have a universal function.
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request, getting the screen size of the keyboard

Joshua Granick
That won't work for a tablet, where a keyboard can float, or not cover the whole bottom of a screen on iOS.

I added this to an old codebase, but need to implement again for SDL 2. Here's some of the relevant code:


iOS

https://github.com/openfl/lime/blob/legacy/legacy/project/src/iPhone/UIStageView.mm#L2276
https://github.com/openfl/lime/blob/legacy/legacy/project/src/iPhone/UIStageView.mm#L3159-L3169
https://github.com/openfl/lime/blob/legacy/legacy/project/src/iPhone/UIStageView.mm#L2979-L2982


Android

https://github.com/openfl/lime/blob/legacy/legacy/templates/android/template/src/org/haxe/lime/GameActivity.java#L77
https://github.com/openfl/lime/blob/legacy/legacy/templates/android/template/src/org/haxe/lime/GameActivity.java#L133-L141
https://github.com/openfl/lime/blob/legacy/legacy/templates/android/template/src/org/haxe/lime/GameActivity.java#L335-L349


This code isn't perfect, but it's something I've been meaning to revisit it


On Thu, 05 Jan 2017 08:05:14 -0800, hardcoredaniel <[hidden email]> wrote:

It is a while ago that I looked into this, but I believe you will get a window event (like resized or size changed) that tells you the new window size that you can render on, while the keyboard is shown. From that you can compute the size of the keyboard.


---------- Původní zpráva ----------
Od: EternalLands <[hidden email]>
Komu: [hidden email]
Datum: 5. 1. 2017 16:59:38
Předmět: [SDL] Feature request, getting the screen size of the keyboard


Is there a way to get the size of the OSD keyboard on touch based devices?
The reason I am asking is that I would like to know where to show the user input text, and some keyboards are larger than others (plus, many keyboards can have a size set by the user).
I am interested mainly for Android, although it would be nice to have a universal function.
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



--
Using Opera's mail client: http://www.opera.com/mail/

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request, getting the screen size of the keyboard

Alex Szpakowski
I don’t know how the SDL implementation on Android works, but SDL’s code on iOS makes sure the on-screen text area you specify with SDL_SetTextInputRect is always visible, by pushing the window up if needed while the keyboard is shown.

The above function is available on all platforms.

On Jan 5, 2017, at 4:48 PM, Joshua Granick <[hidden email]> wrote:

That won't work for a tablet, where a keyboard can float, or not cover the whole bottom of a screen on iOS.

I added this to an old codebase, but need to implement again for SDL 2. Here's some of the relevant code:
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org