From 45db1393d66c36e00fa9f0f455f76ecd611a0307 Mon Sep 17 00:00:00 2001 From: gagarinlg Date: Sun, 24 Oct 2021 11:44:26 +0200 Subject: [PATCH] added a way to disable touch screen event handling Needed for EdgeTX issue #185 --- radio/src/thirdparty/libopenui/src/mainwindow.cpp | 3 +++ radio/src/thirdparty/libopenui/src/mainwindow.h | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/radio/src/thirdparty/libopenui/src/mainwindow.cpp b/radio/src/thirdparty/libopenui/src/mainwindow.cpp index 7cbe46111..16f9135d5 100644 --- a/radio/src/thirdparty/libopenui/src/mainwindow.cpp +++ b/radio/src/thirdparty/libopenui/src/mainwindow.cpp @@ -46,6 +46,9 @@ void MainWindow::checkEvents() touchPanelRead(); } + if(!touchEnabled) + touchState.event = TE_NONE; + if (touchState.event == TE_DOWN) { onTouchStart(touchState.x + scrollPositionX, touchState.y + scrollPositionY); slidingWindow = nullptr; diff --git a/radio/src/thirdparty/libopenui/src/mainwindow.h b/radio/src/thirdparty/libopenui/src/mainwindow.h index fc47bdbc3..009c86454 100644 --- a/radio/src/thirdparty/libopenui/src/mainwindow.h +++ b/radio/src/thirdparty/libopenui/src/mainwindow.h @@ -64,6 +64,13 @@ class MainWindow: public Window void checkEvents() override; +#if defined(HARDWARE_TOUCH) + void setTouchEnabled(bool enable) + { + touchEnabled = enable; + } +#endif + void invalidate() { invalidate({0, 0, rect.w, rect.h}); @@ -85,4 +92,7 @@ class MainWindow: public Window static void emptyTrash(); rect_t invalidatedRect; const char * shutdown = nullptr; +#if defined(HARDWARE_TOUCH) + bool touchEnabled = true; +#endif };