1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Android: open input dialog on double tap with physical keyboard.

Co-authored-by: grorp <grorp@posteo.de>
This commit is contained in:
siliconsniffer 2025-06-17 10:32:35 +02:00
parent 81d62d01d1
commit 70f10f2084

View file

@ -246,8 +246,9 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
#ifdef __ANDROID__ #ifdef __ANDROID__
// display software keyboard when clicking edit boxes // display software keyboard when clicking edit boxes
if (event.EventType == EET_MOUSE_INPUT_EVENT && if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN && ((event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN &&
!porting::hasPhysicalKeyboardAndroid()) { !porting::hasPhysicalKeyboardAndroid()) ||
event.MouseInput.Event == EMIE_LMOUSE_DOUBLE_CLICK)) {
gui::IGUIElement *hovered = gui::IGUIElement *hovered =
Environment->getRootGUIElement()->getElementFromPoint( Environment->getRootGUIElement()->getElementFromPoint(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)); core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
@ -276,7 +277,9 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
porting::showTextInputDialog("", porting::showTextInputDialog("",
wide_to_utf8(((gui::IGUIEditBox *) hovered)->getText()), type); wide_to_utf8(((gui::IGUIEditBox *) hovered)->getText()), type);
return retval; // Since we have opened the dialog, we have to return true to mark
// the event as handled (avoids double-opening).
return true;
} }
} }