From eff7870c9a5eebbd90545b8f4942e3095089dfd6 Mon Sep 17 00:00:00 2001 From: philmoz Date: Mon, 16 Dec 2024 22:43:13 +1100 Subject: [PATCH] Fix rotary encoder events not always working on some screens. --- radio/src/gui/colorlcd/libui/table.cpp | 10 ++++++++++ radio/src/gui/colorlcd/libui/table.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/radio/src/gui/colorlcd/libui/table.cpp b/radio/src/gui/colorlcd/libui/table.cpp index e4884ee983b..83b296a8673 100644 --- a/radio/src/gui/colorlcd/libui/table.cpp +++ b/radio/src/gui/colorlcd/libui/table.cpp @@ -320,3 +320,13 @@ void TableField::setAutoEdit() lv_group_set_editing(g, true); } } + +void TableField::deleteLater(bool detach, bool trash) +{ + if (!deleted()) + if (autoedit) { + lv_group_t* g = (lv_group_t*)lv_obj_get_group(lvobj); + lv_group_set_focus_cb(g, nullptr); + lv_group_set_editing(g, false); + } +} diff --git a/radio/src/gui/colorlcd/libui/table.h b/radio/src/gui/colorlcd/libui/table.h index d088e06182a..1ad0bdc99fe 100644 --- a/radio/src/gui/colorlcd/libui/table.h +++ b/radio/src/gui/colorlcd/libui/table.h @@ -64,5 +64,7 @@ class TableField : public Window void onEvent(event_t event) override; bool onLongPress() override; + void deleteLater(bool detach = true, bool trash = true) override; + static void force_editing(lv_group_t* g) { lv_group_set_editing(g, true); } };