News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[r11913] Android can't close the window with "Back"

Started by Mishasama, March 27, 2026, 09:36:47 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Mishasama

When the cursor in the text box is active, using the back button or gestures will only close the virtual keyboard, unlike other situations where the current window can be closed directly.

Additionally, triggering the back action after selecting text in a text box will delete the selected text, rather than simply closing the virtual keyboard or window.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

This is handled from SDL as we do not handle that event (not even sure if it propagate). Simutrans is not even aware of a virtual keyboard, this is all SDLs doing.

Mishasama

Quote from: prissi on March 28, 2026, 12:11:42 PMThis is handled from SDL as we do not handle that event (not even sure if it propagate). Simutrans is not even aware of a virtual keyboard, this is all SDLs doing.
So... are we just supposed to wait for SDL3 to be released now?  ???
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

Yona-TYT

Quote from: Mishasama on March 29, 2026, 01:36:57 AMSo... are we just supposed to wait for SDL3 to be released now?  ???
SLD3 has been around between us, the problem is porting Simutrans there.  :P

Mishasama

Quote from: Yona-TYT on March 29, 2026, 01:49:02 AMSLD3 has been around between us, the problem is porting Simutrans there.  :P
Could we use AI to accomplish this task? It seems like another huge undertaking.  :o
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

I am not sure if SDL3 will help. I think SDL decided to close the keyboard with the back gesture. So we cannot do much. There is no SDL event associated with it, it is probably just sent as backspace. But if there is a gesture, it may also trigger a touch event. The touch even routines are horrible, some braindead stupid idiot decided to return floats on a screen made out of discrete pixels ... Not to mention the effort of detecting double clicks and multigestures.

Also, someone needs a physical device as the emulator behaves apparently differently. (Or other Android version does behave slightly different?

Simutrans can be linked also with the SDL3 compatibility layers. Rebuilding the build system is the problem with all the downloads and cross dependencies.

Going SDL3 requires a rewrite of the sound system and some of the events and drawing stuff but with zero gain. Honestly, the windows GDI core API is more stable than SDL, the same since windows 3.11 from 1992 while it is already the third SDL API revision. For a cross-compatible library with a large user base, this is disappointing, to use mild words.

Yona-TYT

Dear @prissi, I think you're being a bit too harsh with SDL, hehe. ;)

But yes, this reminds me a lot of the Android APIs; they're always messing everything up and breaking compatibility in the process. It seems like the API maintainers hate Android developers.  :o

Mishasama

SDL3 has native IME support and should be able to handle events correctly in modern systems.

Since SDL2 does not give you a real "Back"  event, but you can propose a partial workaround:

Idea: Detect Backspace + IME active → treat as "close window"

SDL2 exposes SDL_TEXTEDITING when IME composition is active.

So you can propose:
  • If SDLK_BACKSPACE arrives
  • AND the last event was SDL_TEXTEDITING
  • THEN treat it as "close dialog" instead of deleting text

This is not perfect, but it avoids the worst behavior (deleting selected text).  :police:
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。