Quick shortcuts invisible after virtual keyboard closed manually
Describe the bug
There seems to be an issue with the logic that decides when to draw the quick shortcuts in the Android version. After closing the virtual keyboard, the shortcuts are sometimes invisible, though still able to be pressed.
As far as I can tell, the shortcuts only reappear when the keyboard is closed automatically by the "Auto-manage virtual keyboard" setting or (with the keyboard already closed) by leaving a text-editing context by double-tapping to send an escape key.
Attach save file
N/A
Steps to reproduce
With visible shortcuts:
- Open virtual keyboard by any means
- Press back button to close virtual keyboard
- Shortcuts are now invisible
With invisible shortcuts (and "Auto-manage virtual keyboard" turned on):
- Open virtual keyboard by any means
- Press any key that causes the virtual keyboard to be automatically closed (Return, Esc, etc.)
- Shortcuts are visible again
With invisible shortcuts (and "Auto-manage virtual keyboard" turned on):
- Open a text-editing box ("Default character name" setting, for example)
- Double tap to close text-editing box
- Shortcuts are visible again
With invisible shortcuts (and "Auto-manage virtual keyboard" turned off):
- Do whatever you want
- It won't bring back your precious shortcuts
Expected behavior
The quick shortcuts should be there whenever the virtual keyboard isn't open.
Screenshots
No response
Versions and configuration
- OS: Android
- OS Version: Manufacturer: Google; Model: Pixel 6 Pro; Release: 14; Incremental: 11084887;
- Game Version: b459ff5 [64-bit]
Additional context
No response
Briefly poking around, removing the SDL_IsTextInputActive() check from the following in src/sdltiles.cpp:
// Draw quick shortcuts on top of the game view
void draw_quick_shortcuts()
{
if( !quick_shortcuts_enabled ||
SDL_IsTextInputActive() ||
( get_option<bool>( "ANDROID_HIDE_HOLDS" ) && !is_quick_shortcut_touch && finger_down_time > 0 &&
SDL_GetTicks() - finger_down_time >= static_cast<uint32_t>(
get_option<int>( "ANDROID_INITIAL_DELAY" ) ) ) ) { // player is swipe + holding in a direction
return;
}
...
}
seems to produce the expected behavior for me. I'm not familiar enough with SDL or CDDA to actually suggest that as a solution, but it might be a good starting point for someone who knows better.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
Part of the problem is Google's gestural navigation. The code to toggle shortcuts depends on the back button being held down for longer than the "Input repeat delay setting", and there's no way to hold a back gesture. It just sends SDL_KEYDOWN and SDL_KEYUP events immediately.
Switching to three-button navigation allows you to hold the back button and toggle the shortcuts manually. For me, it also inexplicably causes the shortcuts to reappear as expected after closing the keyboard whether I hold the back button down or not, even with "Auto-manage virtual keyboard" turned off.
There's definitely some weirdness happening here and I'll work on ironing it out, but this is a decent workaround in the meantime.
So it looks like the game isn't getting the KEYDOWN/UP events for back keys sent while the keyboard is open. They still close the keyboard, but don't run the code meant to stop text input when the keyboard is closed, thus preventing the shortcuts from being drawn.
...unless you use three-button navigation. When using the three-button-navigation back button, it stops the text input by some other means, allowing the shortcuts to appear. I do not know what those means are, or why they don't work for back gestures.
Here are some of the most relevant looking logcat outputs for each method, in case they help.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.