From d57305210d03974b80a7003f2aae43f6fff68943 Mon Sep 17 00:00:00 2001 From: Gregor Parzefall Date: Sun, 17 Dec 2023 09:56:25 +0100 Subject: [PATCH] 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 53886dcdb52de80d862539e22950c84fbf88df88. --- src/gui/modalMenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp index 0f5ec787a..d00d9617b 100644 --- a/src/gui/modalMenu.cpp +++ b/src/gui/modalMenu.cpp @@ -278,7 +278,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event) irr_ptr 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(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();