diff --git a/radio/src/thirdparty/libopenui/src/mainwindow.cpp b/radio/src/thirdparty/libopenui/src/mainwindow.cpp index a3ce2d0f9..604dac494 100644 --- a/radio/src/thirdparty/libopenui/src/mainwindow.cpp +++ b/radio/src/thirdparty/libopenui/src/mainwindow.cpp @@ -22,73 +22,34 @@ #include "lvgl/lvgl.h" -#if defined(HARDWARE_TOUCH) -#include "touch.h" -#endif -#if defined(HARDWARE_TOUCH) -TouchState touchState; -#endif MainWindow * MainWindow::_instance = nullptr; MainWindow::MainWindow() : - Window(nullptr, {0, 0, LCD_W, LCD_H}, OPAQUE), - invalidatedRect(rect) + Window(nullptr, {0, 0, LCD_W, LCD_H}, OPAQUE), invalidatedRect(rect) { } void MainWindow::emptyTrash() { - for (auto window: trash) { + for (auto window : trash) { delete window; } trash.clear(); } -#if defined(HARDWARE_TOUCH) -void MainWindow::setTouchEnabled(bool enable) -{ - switch(touchEnableState) - { - case TouchOn: - if(!enable) - touchEnableState = TouchOff; - break; - case TouchOn_Touching: - if(!enable) - touchEnableState = TouchOnToOff_Touching; - break; - case TouchOnToOff_Touching: - if(enable) - touchEnableState = TouchOn_Touching; - break; - case TouchOff: - if(enable) - touchEnableState = TouchOn; - break; - case TouchOff_Touching: - if(enable) - touchEnableState = TouchOffToOn_Touching; - break; - case TouchOffToOn_Touching: - if(!enable) - touchEnableState = TouchOff_Touching; - break; - } -} -#endif -void MainWindow::invalidate(const rect_t & rect) +void MainWindow::invalidate(const rect_t& rect) { if (invalidatedRect.w) { auto left = limit(0, rect.left(), invalidatedRect.left()); auto right = limit(invalidatedRect.right(), rect.right(), LCD_W); auto top = limit(0, rect.top(), invalidatedRect.top()); - auto bottom = limit(rect.bottom(), invalidatedRect.bottom(), LCD_H); + auto bottom = + limit(rect.bottom(), invalidatedRect.bottom(), LCD_H); invalidatedRect = {left, top, right - left, bottom - top}; - } - else { + } else { invalidatedRect = rect; } } @@ -101,9 +62,10 @@ void MainWindow::run(bool trash) if (opaque) opaque->checkEvents(); if (trash) emptyTrash(); - + auto delta = ticksNow() - start; if (delta > 10 * SYSTEM_TICKS_1MS) { - TRACE_WINDOWS("MainWindow::run took %dms", (ticksNow() - start) / SYSTEM_TICKS_1MS); + TRACE_WINDOWS("MainWindow::run took %dms", + (ticksNow() - start) / SYSTEM_TICKS_1MS); } } diff --git a/radio/src/thirdparty/libopenui/src/mainwindow.h b/radio/src/thirdparty/libopenui/src/mainwindow.h index 045614379..58e0f1fe8 100644 --- a/radio/src/thirdparty/libopenui/src/mainwindow.h +++ b/radio/src/thirdparty/libopenui/src/mainwindow.h @@ -62,17 +62,6 @@ class MainWindow: public Window } #endif -#if defined(HARDWARE_TOUCH) - void setTouchEnabled(bool enable); - bool touchEventOccured() { - if(_touchEventOccured) - { - _touchEventOccured = false; - return true; - } - return false; - } -#endif void setActiveScreen() { lv_scr_load(lvobj); @@ -99,18 +88,4 @@ class MainWindow: public Window static void emptyTrash(); rect_t invalidatedRect; const char * shutdown = nullptr; -#if defined(HARDWARE_TOUCH) - bool lastTouchState = false; - bool _touchEventOccured = false; - - enum TouchEnableState { - TouchOn, - TouchOn_Touching, - TouchOnToOff_Touching, - TouchOff, - TouchOff_Touching, - TouchOffToOn_Touching - }; - TouchEnableState touchEnableState = TouchOn; -#endif };