Fix touch input on Linux

The code relied on touch IDs being consecutive. This is true on Android, but not on Linux.
Therefore, touch input on Linux was broken since 53886dcdb5.
This commit is contained in:
Gregor Parzefall 2023-12-17 09:56:25 +01:00 committed by rubenwardy
parent fdb5cc0061
commit d57305210d
1 changed files with 2 additions and 2 deletions

View File

@ -278,7 +278,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
irr_ptr<GUIModalMenu> holder;
holder.grab(this); // keep this alive until return (it might be dropped downstream [?])
if (event.TouchInput.ID == 0) {
if (event.TouchInput.touchedCount == 1) {
if (event.TouchInput.Event == ETIE_PRESSED_DOWN || event.TouchInput.Event == ETIE_MOVED)
m_pointer = v2s32(event.TouchInput.X, event.TouchInput.Y);
gui::IGUIElement *hovered = Environment->getRootGUIElement()->getElementFromPoint(core::position2d<s32>(m_pointer));
@ -295,7 +295,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
if (event.TouchInput.Event == ETIE_LEFT_UP)
leave();
return ret;
} else if (event.TouchInput.ID == 1) {
} else if (event.TouchInput.touchedCount == 2) {
if (event.TouchInput.Event != ETIE_LEFT_UP)
return true; // ignore
auto focused = Environment->getFocus();