From 6dbae9593eae4d2bc55aa34fdde428fbd2933ccf Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 14 Jan 2022 11:20:22 +0800 Subject: [PATCH] UI: reset interactivity timeout on PC (#23508) * reset interactive timeout on pc * cleanup Co-authored-by: Adeeb Shihadeh --- selfdrive/ui/qt/window.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index 0fee52f736..e2e4fc9082 100644 --- a/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/qt/window.cc @@ -80,19 +80,20 @@ void MainWindow::closeSettings() { } bool MainWindow::eventFilter(QObject *obj, QEvent *event) { - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::TouchBegin) { - device.resetInteractiveTimout(); - } + const QSet evts({QEvent::MouseButtonPress, QEvent::MouseMove, + QEvent::TouchBegin, QEvent::TouchUpdate, QEvent::TouchEnd}); + if (evts.contains(event->type())) { + device.resetInteractiveTimout(); #ifdef QCOM - // filter out touches while in android activity - const static QSet filter_events({QEvent::MouseButtonPress, QEvent::MouseMove, QEvent::TouchBegin, QEvent::TouchUpdate, QEvent::TouchEnd}); - if (HardwareEon::launched_activity && filter_events.contains(event->type())) { - HardwareEon::check_activity(); + // filter out touches while in android activity if (HardwareEon::launched_activity) { - return true; + HardwareEon::check_activity(); + if (HardwareEon::launched_activity) { + return true; + } } - } #endif + } return false; }