We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5021 - SDL_StartTextInput() does not trigger OSK on Wayland with Phosh
Summary: SDL_StartTextInput() does not trigger OSK on Wayland with Phosh
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.10
Hardware: ARM Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-09 19:27 UTC by tizilogic
Modified: 2020-05-29 00:11 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tizilogic 2020-03-09 19:27:58 UTC
As far as I can tell from the documentation, calling SDL_StartTextInput() on mobile devices is supposed to trigger the onscreen keyboard. This does not appear to be the case with the Pinephone running Phosh. 

My configuration on the Pinephone, where I encountered this problem is:

 - postmarketOS (Alpine Linux based / Linux pinephone 5.5.0 #2-postmarketos-allwinner SMP Mon Mar 2 00:34:15 UTC 2020 aarch64 Linux)
 - Compositor: Phoc (https://source.puri.sm/Librem5/phoc)
 - Wayland shell: Phosh (https://source.puri.sm/Librem5/phosh)
 - SDL2 version, as shown in the Alpine package manager: 2.0.10-r1

I tried both windowed and fullscreen mode and neither triggers the keyboard.
Comment 1 Sam Lantinga 2020-03-10 14:23:46 UTC
That's correct, nobody has implemented onscreen keyboard support for that setup. Are there other applications that can bring up the on-screen keyboard? If so, how do they do that?
Comment 2 tizilogic 2020-03-10 15:35:52 UTC
I got in contact with the developers and received the following information:

"""
The protocol to control popup:

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml

the flow is rather simple: the application needs to request a zwp_text_input_v3 object from the manager via https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml#L433

then it must listen for enter https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml#L306
and finally commit an enable request https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml#L87

after editing is over, send a disable request
"""

Let me know if you need more information
Comment 3 tizilogic 2020-03-10 15:40:41 UTC
After commenting before I also got an example on how this is implemented in GTK:

https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/modules/input/imwayland.c
Comment 4 tizilogic 2020-03-10 15:58:58 UTC
Also potentially helpful information I just received from the dev that implemented the protocol in the first place (Dorota):

"""
luckily, I'm in the process of redesigning the protocol (it's broken :(), so if I wrap my head around why I actually made it, I may be able to distill some insight for SDL. If someone interested from SDL filed an issue upstream, I'll give it proper thought: https://gitlab.freedesktop.org/wayland/wayland-protocols/issues
"""
Comment 5 Ellie 2020-05-19 16:39:05 UTC
Isn't this protocol needed for ANY Wayland platform to bring up the on-screen keyboard, like any device with touch where the on-screen keyboard should be used?

E.g. I have a linux laptop with touch, when I tap the screen over e.g. a gnome-terminal the gnome 3 onscreen keyboard comes up. I would assume for any SDL2 app it doesn't. Supporting this protocol would likely fix that. So this really doesn't seem to be Phosh-specific, or even mobile device-specific to me, and likely can be tested on any touch-capable device I would assume.

This appears to be the current protocol in question:

https://fossies.org/linux/misc/gtk+-3.24.20.tar.xz:a/gtk+-3.24.20/modules/input/text-input-unstable-v3-client-protocol.h
Comment 6 Sebastian Krzyszkowiak 2020-05-29 00:11:02 UTC
> Isn't this protocol needed for ANY Wayland platform to bring up the on-screen keyboard, like any device with touch where the on-screen keyboard should be used?

Of course. This is by no means phosh specific.

> This appears to be the current protocol in question:

A more useful link is https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml which is already in comment #2.